From 0640d7048ee649eb8979f5bb02457fe3d503d4e9 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 29 Feb 2020 20:12:33 +0100 Subject: [PATCH] qindex should be between 0 and 4 to avoid overread (AFL) --- camlibs/gsmart300/gsmart300.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/camlibs/gsmart300/gsmart300.c b/camlibs/gsmart300/gsmart300.c index 5c90dcaf1..990f9d925 100644 --- a/camlibs/gsmart300/gsmart300.c +++ b/camlibs/gsmart300/gsmart300.c @@ -144,6 +144,11 @@ gsmart300_request_file (CameraPrivateLibrary * lib, CameraFile *file, + (p[11] & 0xff); qIndex = p[7] & 0x07; + if (qIndex >= 5) { + GP_DEBUG("qIndex %d is larger or equal than 5\n", qIndex); + return GP_ERROR_CORRUPTED_DATA; + } + file_size = data_size + GSMART_JPG_DEFAULT_HEADER_LENGTH + 1024 * 10; if (flash_size < data_size) {