From fd110c3419d1c06baa32c721d4e3a749a2c2aee8 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 21 Feb 2019 10:58:44 +0900 Subject: [PATCH] vector stb: check oom for safety. --- src/vector/stb/stb_image.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vector/stb/stb_image.h b/src/vector/stb/stb_image.h index d284fd090d..b52db63f28 100644 --- a/src/vector/stb/stb_image.h +++ b/src/vector/stb/stb_image.h @@ -3771,6 +3771,10 @@ static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp) { int result; stbi__jpeg* j = (stbi__jpeg*) (stbi__malloc(sizeof(stbi__jpeg))); + if (!j) { + stbi__errpuc("outofmem", "Out of memory"); + return 0; + } j->s = s; result = stbi__jpeg_info_raw(j, x, y, comp); STBI_FREE(j);