aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-07-05 12:22:26 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-07-05 11:43:19 +0000
commitbeb4e8def320cd266c6d992ad3b963a9a6e19639 (patch)
tree2379c86e4502d96428ae88704aa73f453cedf9f1
parentb74bb60b0b66b4cb1c01655d31e39964ed46dfff (diff)
prog: stop mutating crashing images
-rw-r--r--prog/hints.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/prog/hints.go b/prog/hints.go
index c96989b75..ce83c009f 100644
--- a/prog/hints.go
+++ b/prog/hints.go
@@ -219,7 +219,8 @@ func checkCompressedArg(arg *DataArg, compMap CompMap, exec func() bool) {
// numbers and checksums. We also ignore 0 and ^uint64(0) source bytes,
// because there are too many of these in lots of images.
bytes := make([]byte, 8)
- for i := 0; i < len(data); i += 4 {
+ doMore := true
+ for i := 0; i < len(data) && doMore; i += 4 {
original := make([]byte, 8)
copy(original, data[i:])
val := binary.LittleEndian.Uint64(original)
@@ -231,7 +232,7 @@ func checkCompressedArg(arg *DataArg, compMap CompMap, exec func() bool) {
// Execution can take a while and uncompressed images are large,
// since hints jobs are executed round-robin, we can have thousands of them running.
dtor()
- doMore := exec()
+ doMore = exec()
data, dtor = image.MustDecompress(data0)
if !doMore {
break