hiredis icon indicating copy to clipboard operation
hiredis copied to clipboard

Crash- Segmentation fault in sdscatlen-> sdsMakeRoomFor -> realloc

Open sg893052 opened this issue 9 months ago • 3 comments

Application crashed due to a segmentation fault while processing Redis DB events.

libhiredis version: 0.14.1-1 Distribution: Bullseye

(gdb) bt #0 0x00007f932b1139b0 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007f932b116615 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x00007f932b1178d6 in realloc () from /lib/x86_64-linux-gnu/libc.so.6 #3 0x00007f934938c2df in sdsMakeRoomFor () from /usr/lib/x86_64-linux-gnu/libhiredis.so.0.14 #4 0x00007f934938cbb4 in sdscatlen () from /usr/lib/x86_64-linux-gnu/libhiredis.so.0.14 #5 0x00007f9349389db0 in redisvFormatCommand () from /usr/lib/x86_64-linux-gnu/libhiredis.so.0.14

sg893052 avatar Mar 19 '25 09:03 sg893052

Any more details of the arguments in frame 3, 4 and 5?

bjosv avatar Mar 19 '25 10:03 bjosv

We'd need more context to make a guess, really. A program that reproduces the problem would be most ideal, but short of that you could try catching it in a recording debuger like rr. Failing that, info about the arguments would be very helpful as well.

libhiredis version: 0.14.1-1

It's also a really old version of hiredis.

michael-grunder avatar Mar 19 '25 18:03 michael-grunder

Without more context, there's not much we can do to help track this down.

If you're still encountering this crash you could try to run your program under valgrind or build it with sanitizers to see if there is corruption occuring elsewhere.

michael-grunder avatar Mar 28 '25 17:03 michael-grunder