Commit 744cbeb
Raise instead of hanging on a truncated frame in Zstd.decompress
decode_one_frame looped until ZSTD_decompressStream returned 0. For a
truncated/incomplete frame libzstd keeps returning a non-zero "need more
input" hint while consuming and producing nothing, so the loop spun
forever. Because ZSTD_decompressStream is called directly (GVL held),
this froze the whole VM at 100% CPU and ignored SIGTERM.
A header-only frame reproduces it:
Zstd.decompress("\x28\xB5\x2F\xFD") # hung forever
Detect the no-progress case (no output produced and no input consumed
with a non-zero return) and raise, matching the streaming decompressor
which already stops when the input is exhausted. Add a regression spec.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent b9e3c8e commit 744cbeb
2 files changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
106 | 118 | | |
107 | 119 | | |
108 | 120 | | |
| |||
0 commit comments