Closed mayursankpal closed 8 months ago
Looks like you aren't making redisConnect
is returning a valid context as c=0x0
.
So you've got a NULL
redisContext
making redisContext->obuf
just 0 + the offset of that member, which if course is not a valid sds
string :smile:
I can't help much more than that without a bit of code that reproduces the issue. Fix should be simple though. Just make sure redisConnect
is returning a valid pointer and c->err
is not set.
Closing as this doesn't seem to be a bug in hiredis but still happy to answer any other questions you have.
Hiredis version = 0.11.0 OS = Debian GNU/Linux 11 (bullseye) Redis server v=6.0.16 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=6d95e1af3a2c082a
Scenario ==> Inserting data into redis DB ...Called from one of the unit test [googletest] Command ==> "HSET <some_key> state off"
Stack Trace Program received signal SIGSEGV, Segmentation fault. __redisAppendCommand (c=0x0, cmd=0x4daf10 "*4\r\n$4\r\nHSET\r\n$20\r\nsome_key\r\n$5\r\nstate\r\n$3\r\noff\r\n", len=61) at hiredis.c:1186 1186 newbuf = sdscatlen(c->obuf,cmd,len); (gdb) bt
0 __redisAppendCommand (c=0x0,
1 0x00007fffff6f461c in redisvAppendCommand (c=0x0, format=, ap=) at hiredis.c:1206
2 0x00007fffff6f4792 in redisvCommand (c=0x0, format=, ap=ap@entry=0x7ffffffed498) at hiredis.c:1267
3 0x00007fffff6f4847 in redisCommand (c=,