Commit 277fabe
committed
Fix: Ensure mapping is sorted in NewHeader for binary search correctness
The getMapping function uses sort.Search which requires mappings to be
sorted by Offset. While all current callers provide sorted mappings,
NewHeader is a public API that didn't enforce this invariant. This could
lead to silent data corruption if future callers or deserialized data
provide unsorted mappings. Added sort.Slice to guarantee correctness.1 parent b90faf6 commit 277fabe
File tree
1 file changed
+4
-0
lines changed1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
0 commit comments