diff options
| author | Michael Lee <leecommamichael@gmail.com> | 2025-09-08 09:08:07 -0500 |
|---|---|---|
| committer | Michael Lee <leecommamichael@gmail.com> | 2025-09-08 09:08:07 -0500 |
| commit | cfde843778c865b2fc90b05f63e9143c6b9cd59f (patch) | |
| tree | efdfb4bf87d2e0491d19fcb8ecd0aa247bbce658 /core/image | |
| parent | 42c2cb89b580acc228a5e54988b40cf56f99c95f (diff) | |
[core:image/png] use .Image_Dimensions_Too_Large
Diffstat (limited to 'core/image')
| -rw-r--r-- | core/image/png/png.odin | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/image/png/png.odin b/core/image/png/png.odin index 87efcf9b5..ef3d617eb 100644 --- a/core/image/png/png.odin +++ b/core/image/png/png.odin @@ -250,10 +250,14 @@ read_header :: proc(ctx: ^$C) -> (image.PNG_IHDR, Error) { header := (^image.PNG_IHDR)(raw_data(c.data))^ // Validate IHDR using header - if width == 0 || height == 0 || u128(width) * u128(height) > image.MAX_DIMENSIONS { + if width == 0 || height == 0 { return {}, .Invalid_Image_Dimensions } + if u128(width) * u128(height) > image.MAX_DIMENSIONS { + return {}, .Image_Dimensions_Too_Large + } + if compression_method != 0 { return {}, compress.General_Error.Unknown_Compression_Method } |