Commit b0a269e
authored
qcow-stream-tool: Avoid stack overflows in read_headers (#6848)
Otherwise we overflow the stack on large QCOW files:
qcow-stream-tool: internal error, uncaught exception:
Stack overflow
Raised by primitive operation at
Dune__exe__Qcow_stream_tool.Impl.read_headers.(fun) in file
"ocaml/qcow-stream-tool/qcow_stream_tool.ml", line 23, characters 12-24
Called from Stdlib__List.map in file "list.ml", line 92, characters
32-39
Called from Stdlib__List.map in file "list.ml", line 92, characters
32-39
....
Going through `map->seq->list` transformations is faster than reversing
a list
with `List.rev + List.rev_map`.1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
25 | | - | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
0 commit comments