From 193e6ca5e48ee99e620f0e7546f1407ba1a20323 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 14 Mar 2017 15:53:36 -0700 Subject: Add IndexInBounds() convenience routine. Avoid writing |Type| in CollectionSize() so that index type can change without rewriting conditions. Change-Id: I40c94ca39148b379908760ba9b861114b88af7bb Reviewed-on: https://pdfium-review.googlesource.com/3056 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- core/fxcodec/lgif/fx_gif.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/fxcodec/lgif/fx_gif.cpp') diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp index c4661b0acd..c109b6193d 100644 --- a/core/fxcodec/lgif/fx_gif.cpp +++ b/core/fxcodec/lgif/fx_gif.cpp @@ -841,11 +841,11 @@ int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) { gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA); return 1; } + int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) { - if (!gif_ptr || frame_num < 0 || - frame_num >= pdfium::CollectionSize(*gif_ptr->img_ptr_arr_ptr)) { + if (!gif_ptr || !pdfium::IndexInBounds(*gif_ptr->img_ptr_arr_ptr, frame_num)) return 0; - } + uint8_t* data_size_ptr = nullptr; uint8_t* data_ptr = nullptr; uint32_t skip_size_org = gif_ptr->skip_size; -- cgit v1.2.3