summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/starpbm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bin/starpbm.c b/src/bin/starpbm.c
index fd3f235..ba4e46d 100644
--- a/src/bin/starpbm.c
+++ b/src/bin/starpbm.c
@@ -140,6 +140,7 @@ main(int argc, char *argv[])
}
const size_t pos = (last_black - &pixels[y * w]) + 1;
+ assert(y * w + pos <= w * h);
fprintf(output, "b%c%c", (char)(pos % 256), (char)(pos / 256));
fwrite(&pixels[y * w], 1, pos, output);
}