Commit c3b3439
zstd: don't clear the registered dictionary when decoding past the window (#1177)
* zstd: don't clear the registered dictionary when decoding past the window
executeSequences set hist.dict.content = nil when the frame history grew
past the window. hist.dict is the same *dict registered via
WithDecoderDicts/WithDecoderDictRaw, so this blanked the dictionary for
every later decode on the decoder: after one streaming decode of a
dictionary frame larger than the window, subsequent decodes of a valid
dictionary frame failed with 'match offset (...) bigger than current
history'. The write was dead for the current decode (the streaming path
reads its own hist.decoders.dict copy) and only ever corrupted reuse.
Drop the mutation and keep the window trim; the shared dictionary is now
left intact, matching the sync decode path.
Add TestDecoderDictReuseAfterLargeStream (fails before, passes after).
* go fix
* Move test into existing file and simplify the test somewhat. Verified that it still reproduces.
---------
Co-authored-by: Klaus Post <klauspost@gmail.com>1 parent 9874bc9 commit c3b3439
2 files changed
Lines changed: 48 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | 677 | | |
682 | 678 | | |
683 | 679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1056 | 1056 | | |
1057 | 1057 | | |
1058 | 1058 | | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
0 commit comments