Repository navigation
RED-180951 RED-180027 fixing bugs and improving the code - #2003
Conversation
Co-authored-by: Cursor <[email protected]>
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Reviewed by Cursor Bugbot for commit 98ad77c. Configure here.
| if (compchunk->idx > len * 8) { | ||
| err = true; | ||
| return TSDB_ERROR; /* Bit index can't exceed buffer size in bits */ | ||
| } |
There was a problem hiding this comment.
Missing size-buffer length validation in compressed chunk load
High Severity
The new validation in Compressed_LoadFromRDB checks len == 0 and compchunk->idx > len * 8 but does not validate that compchunk->size == len. In chunk.c, the equivalent check uncompchunk->size != string_buffer_size is present, but compressed_chunk.c is missing it. Since compchunk->size is used directly for serialization (saveStringBuffer reads compchunk->size bytes from compchunk->data) and buffer arithmetic, a crafted payload with compchunk->size > len causes a heap over-read.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 98ad77c. Configure here.
|
|
||
| _patch_dump_crc(b) | ||
| assert _verify_dump_payload(bytes(b)), "patched DUMP payload should have valid checksum" | ||
| return bytes(b) |
There was a problem hiding this comment.
Unused helper function and dependencies are dead code
Low Severity
_patch_first_uncompressed_chunk_num_samples is defined but never called anywhere in the codebase. Since it's the sole caller of _verify_dump_payload, _patch_dump_crc, _rdb_load_len, _rdb_skip_string, _rdb_read_string_len_and_skip, and _crc_reflect64 / _redis_crc64, the entire chain of ~100 lines of helper code is unreachable dead code.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 98ad77c. Configure here.
JSON - 8.7.91: * Cherry-pick bug fixes to 8.8 (RedisJSON/RedisJSON#1557) * MOD-6722 Fix mutation ordering for array commands with recursive paths (RedisJSON/RedisJSON#1543) * MOD-7266 make sure to end() deserialization, to disallow trailing c… (RedisJSON/RedisJSON#1554) * MOD-14664 Json Path evaluation - Allow multi-result nodelists in filt… (RedisJSON/RedisJSON#1542) Bloom - 8.7.91 * Lili: RED-180951 RED-181297 RED-184457 RED-184456 RED-184458 RED-184459 fixing bugs and improving the code (RedisBloom/RedisBloom#1002) * MOD-14675 - refresh os list to 8.8 (RedisBloom/RedisBloom#976) Time Series - 8.7.91: * MOD-15262 - Align TimeSeries with the RedisModule_GetUserUserName API… (RedisTimeSeries/RedisTimeSeries#1985) * MOD-14420 fix count reducers return wrong NaN (RedisTimeSeries/RedisTimeSeries#2013) (RedisTimeSeries/RedisTimeSeries#2016) * Lili- RED-180951 RED-180027 fixing bugs and improving the code (RedisTimeSeries/RedisTimeSeries#2003) * MOD-14674 - refresh os list to 8.8 (RedisTimeSeries/RedisTimeSeries#1946)
JSON - 8.7.91: * Cherry-pick bug fixes to 8.8 (RedisJSON/RedisJSON#1557) * MOD-6722 Fix mutation ordering for array commands with recursive paths (RedisJSON/RedisJSON#1543) * MOD-7266 make sure to end() deserialization, to disallow trailing c… (RedisJSON/RedisJSON#1554) * MOD-14664 Json Path evaluation - Allow multi-result nodelists in filt… (RedisJSON/RedisJSON#1542) Bloom - 8.7.91 * Lili: RED-180951 RED-181297 RED-184457 RED-184456 RED-184458 RED-184459 fixing bugs and improving the code (RedisBloom/RedisBloom#1002) * MOD-14675 - refresh os list to 8.8 (RedisBloom/RedisBloom#976) Time Series - 8.7.91: * MOD-15262 - Align TimeSeries with the RedisModule_GetUserUserName API… (RedisTimeSeries/RedisTimeSeries#1985) * MOD-14420 fix count reducers return wrong NaN (RedisTimeSeries/RedisTimeSeries#2013) (RedisTimeSeries/RedisTimeSeries#2016) * Lili- RED-180951 RED-180027 fixing bugs and improving the code (RedisTimeSeries/RedisTimeSeries#2003) * MOD-14674 - refresh os list to 8.8 (RedisTimeSeries/RedisTimeSeries#1946)




Made with Cursor
Note
Medium Risk
Touches RDB/RESTORE deserialization paths for both compressed and uncompressed chunks; while changes are defensive, mistakes could cause valid persisted data to fail loading.
Overview
Hardens RDB loading against corrupted payloads.
Uncompressed_LoadFromRDBnow validatesnum_samplesvs. chunk capacity and requires the loaded buffer length to match the declaredsize;Compressed_LoadFromRDBnow rejects zero-length buffers and ensures the stored bit index (idx) fits within the loaded buffer.Improves portability of
errdeferusage under clang. Introduces a__blockedmacro (maps to__blockon clang, empty on GCC) and applies it toseries_rdb_load’sseriesvariable to keep cleanup logic valid.Adds regression tests for broken RDBs. New
tests/flow/test_borken_rdb.pycrafts truncated/corrupted DUMP payloads and assertsRESTOREfails with the expected errors, including invalid chunk metadata.Reviewed by Cursor Bugbot for commit 98ad77c. Bugbot is set up for automated code reviews on this repo. Configure here.