diff options
author | Oran Agra <oran@redislabs.com> | 2021-09-26 18:46:22 +0300 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2021-10-04 13:59:40 +0300 |
commit | 73d286d523e8f8a205f4bff472874b9c1e4bff61 (patch) | |
tree | 989db1d29f9ea448b4294864c851cde9a799fb76 | |
parent | 4cbccab2bd5102e57e6e188bb05f1e01c9d25322 (diff) | |
download | redis-73d286d523e8f8a205f4bff472874b9c1e4bff61.tar.gz |
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.
(cherry picked from commit 5a4ab7c7d2da1773c5ed3dcfc6e367b5af03a33e)
-rw-r--r-- | src/t_stream.c | 2 | ||||
-rw-r--r-- | tests/integration/rdb.tcl | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/t_stream.c b/src/t_stream.c index 7e67c1b0e..51ac2a31d 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -3628,12 +3628,12 @@ int streamValidateListpackIntegrity(unsigned char *lp, size_t size, int deep) { p = next; if (!lpValidateNext(lp, &next, size)) return 0; /* entry id */ - p = next; if (!lpValidateNext(lp, &next, size)) return 0; lpGetIntegerIfValid(p, &valid_record); if (!valid_record) return 0; p = next; if (!lpValidateNext(lp, &next, size)) return 0; lpGetIntegerIfValid(p, &valid_record); if (!valid_record) return 0; + p = next; if (!lpValidateNext(lp, &next, size)) return 0; if (!(flags & STREAM_ITEM_FLAG_SAMEFIELDS)) { /* num-of-fields */ diff --git a/tests/integration/rdb.tcl b/tests/integration/rdb.tcl index 9e1c2651a..e652e5573 100644 --- a/tests/integration/rdb.tcl +++ b/tests/integration/rdb.tcl @@ -45,7 +45,7 @@ start_server [list overrides [list "dir" $server_path] keep_persistence true] { test {Test RDB stream encoding} { for {set j 0} {$j < 1000} {incr j} { if {rand() < 0.9} { - r xadd stream * foo $j + r xadd stream * foo abc } else { r xadd stream * bar $j } |