mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Fix stream sanitization for non-int first value (#9553)
This was recently broken in #9321 when we validated stream IDs to be integers but did that after to the stepping next record instead of before.
This commit is contained in:
parent
6600253046
commit
5a4ab7c7d2
@ -3603,12 +3603,12 @@ int streamValidateListpackIntegrity(unsigned char *lp, size_t size, int deep) {
|
|||||||
p = next; if (!lpValidateNext(lp, &next, size)) return 0;
|
p = next; if (!lpValidateNext(lp, &next, size)) return 0;
|
||||||
|
|
||||||
/* entry id */
|
/* entry id */
|
||||||
p = next; if (!lpValidateNext(lp, &next, size)) return 0;
|
|
||||||
lpGetIntegerIfValid(p, &valid_record);
|
lpGetIntegerIfValid(p, &valid_record);
|
||||||
if (!valid_record) return 0;
|
if (!valid_record) return 0;
|
||||||
p = next; if (!lpValidateNext(lp, &next, size)) return 0;
|
p = next; if (!lpValidateNext(lp, &next, size)) return 0;
|
||||||
lpGetIntegerIfValid(p, &valid_record);
|
lpGetIntegerIfValid(p, &valid_record);
|
||||||
if (!valid_record) return 0;
|
if (!valid_record) return 0;
|
||||||
|
p = next; if (!lpValidateNext(lp, &next, size)) return 0;
|
||||||
|
|
||||||
if (!(flags & STREAM_ITEM_FLAG_SAMEFIELDS)) {
|
if (!(flags & STREAM_ITEM_FLAG_SAMEFIELDS)) {
|
||||||
/* num-of-fields */
|
/* num-of-fields */
|
||||||
|
@ -45,7 +45,7 @@ start_server [list overrides [list "dir" $server_path] keep_persistence true] {
|
|||||||
test {Test RDB stream encoding} {
|
test {Test RDB stream encoding} {
|
||||||
for {set j 0} {$j < 1000} {incr j} {
|
for {set j 0} {$j < 1000} {incr j} {
|
||||||
if {rand() < 0.9} {
|
if {rand() < 0.9} {
|
||||||
r xadd stream * foo $j
|
r xadd stream * foo abc
|
||||||
} else {
|
} else {
|
||||||
r xadd stream * bar $j
|
r xadd stream * bar $j
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user