Commit a87fe66
fix(hset_family): Fix crash on scan after expiry set (#4802)
When expiry is set on an hset its members are migrated to a string map.
If a scan is performed on the hset, the code branch for string map
accessed the value pointer directly by loading the 64 bit value from the
object pointer.
When creating a new entry in string map with TTL, we also set a bit on
the stored pointer as metadata, this is set as 1 << 63.
As a result when loading back the pointer we need to unset the same bit
to get the correct address, this is done already in string map internals
but the scan code did not do this, resulting in segfault.
This change adds an AND operation to unset the TTL bit before
dereferencing the pointer.
Signed-off-by: Abhijat Malviya <abhijat@dragonflydb.io>1 parent 63328b1 commit a87fe66
File tree
4 files changed
+23
-8
lines changed- src
- core
- server
4 files changed
+23
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 25 | | |
32 | 26 | | |
33 | 27 | | |
| |||
189 | 183 | | |
190 | 184 | | |
191 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
150 | 152 | | |
151 | 153 | | |
152 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
324 | | - | |
| 323 | + | |
325 | 324 | | |
326 | 325 | | |
327 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
510 | 524 | | |
0 commit comments