summaryrefslogtreecommitdiff
path: root/src/image.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/image.zig')
-rw-r--r--src/image.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/image.zig b/src/image.zig
index 19dbb9e4..5ceadd76 100644
--- a/src/image.zig
+++ b/src/image.zig
@@ -771,6 +771,9 @@ pub fn readable(bytes: []const u8) bool {
const Decoded = struct { rgba: []u8, w: usize, h: usize };
pub fn decode(gpa: std.mem.Allocator, bytes: []const u8) ?Decoded {
+ // stb_image allocates through what `start` gave it: before that, a call
+ // jumps through a null pointer (a terminal's PNG in a core no shell set up).
+ if (!started) return null;
if (bytes.len == 0 or bytes.len > std.math.maxInt(c_int)) return null;
// Bounded before decoding: a few KB of PNG can name gigapixels.
var iw: c_int = 0;