diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp index 07fb88fb47..08a2db96c4 100644 --- a/Userland/Libraries/LibGfx/JPGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPGLoader.cpp @@ -420,6 +420,8 @@ static Optional> decode_huffman_stream(JPGLoadingContext& con static inline bool bounds_okay(const size_t cursor, const size_t delta, const size_t bound) { + if (Checked::addition_would_overflow(delta, cursor)) + return false; return (delta + cursor) < bound; }