You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When dstCapacity is zero, in theory the dest pointer should be irrelevant--any pointer value should be allowed (or, alternatively, the docs should specify what is and isn't allowed). However, if ZSTD_decompress is called with dstCapacity=0 and dest having a value of e.g. 0xffffffffffffffff, it will hit UB and may trip an assertion. I'm unsure exactly what range of pointer values will trigger this, but the maximum pointer value definitely does.
Additional context
Might be the same root cause as #3506
This was found because the Zig allocator interface will return a zero-length slice [a pointer + length pair] where the pointer part has the value 0xffffffffffffffff if you request a zero-sized allocation (in lieu of doing a real allocation). See this comment in the fuzzer implementation
The text was updated successfully, but these errors were encountered:
Describe the bug
When
dstCapacity
is zero, in theory thedest
pointer should be irrelevant--any pointer value should be allowed (or, alternatively, the docs should specify what is and isn't allowed). However, ifZSTD_decompress
is called withdstCapacity=0
anddest
having a value of e.g.0xffffffffffffffff
, it will hit UB and may trip an assertion. I'm unsure exactly what range of pointer values will trigger this, but the maximum pointer value definitely does.To Reproduce
ZSTD_decompress
for certain inputs #3506make lib CFLAGS="-fsanitize=undefined -fPIC"
examples/simple_decompression.c
with the following patch:make LDFLAGS="-fsanitize=undefined"
simple_decompression
, e.g../simple_decompression 'id:000000,sig:04,src:000193,time:1035023,execs:294994,op:havoc,rep:4'
Example of the output with
DEBUGLEVEL=10
:And one that trips an assertion:
Expected behavior
No UB
Desktop:
Additional context
Might be the same root cause as #3506
This was found because the Zig allocator interface will return a zero-length slice [a pointer + length pair] where the pointer part has the value
0xffffffffffffffff
if you request a zero-sized allocation (in lieu of doing a real allocation). See this comment in the fuzzer implementationThe text was updated successfully, but these errors were encountered: