24 lines
831 B
Diff
24 lines
831 B
Diff
|
From d66d0fe8c1a6ed393817791e4376374fa7f4ecc1 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Jaroslav=20Loba=C4=8Devski?= <jarlob@github.com>
|
||
|
Date: Thu, 19 Oct 2023 15:42:23 +0200
|
||
|
Subject: [PATCH] Fix int overflow
|
||
|
|
||
|
Fixes #1533
|
||
|
---
|
||
|
stb_image.h | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/stb_image.h b/stb_image.h
|
||
|
index 5e807a0a6..6d63ab32b 100644
|
||
|
--- a/stb_image.h
|
||
|
+++ b/stb_image.h
|
||
|
@@ -2222,7 +2222,7 @@ static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman
|
||
|
dc = j->img_comp[b].dc_pred + diff;
|
||
|
j->img_comp[b].dc_pred = dc;
|
||
|
if (!stbi__mul2shorts_valid(dc, dequant[0])) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
|
||
|
- data[0] = (short) (dc * dequant[0]);
|
||
|
+ data[0] = (short) ((size_t)dc * dequant[0]);
|
||
|
|
||
|
// decode AC components, see JPEG spec
|
||
|
k = 1;
|