Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: core/src/fxcodec/lgif/fx_gif.cpp

Issue 1144683002: Merge to XFA: Abort on OOM by default in FX_Alloc(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Suppress failing tests Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxcodec/lbmp/fx_bmp.cpp ('k') | core/src/fxcrt/fx_basic_memmgr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fx_gif.h" 7 #include "fx_gif.h"
8 void CGifLZWDecoder::Input(FX_LPBYTE src_buf, FX_DWORD src_size) 8 void CGifLZWDecoder::Input(FX_LPBYTE src_buf, FX_DWORD src_size)
9 { 9 {
10 next_in = src_buf; 10 next_in = src_buf;
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr) 1140 FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr)
1141 { 1141 {
1142 return gif_ptr->img_ptr_arr_ptr->GetSize(); 1142 return gif_ptr->img_ptr_arr_ptr->GetSize();
1143 } 1143 }
1144 static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_ buf, FX_DWORD& dst_len ) 1144 static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_ buf, FX_DWORD& dst_len )
1145 { 1145 {
1146 if (gif_ptr->cur_offset) { 1146 if (gif_ptr->cur_offset) {
1147 return TRUE; 1147 return TRUE;
1148 } 1148 }
1149 dst_len = sizeof(GifHeader) + sizeof(GifLSD) + sizeof(GifGF); 1149 dst_len = sizeof(GifHeader) + sizeof(GifLSD) + sizeof(GifGF);
1150 dst_buf = FX_AllocNL(FX_BYTE, dst_len); 1150 dst_buf = FX_TryAlloc(FX_BYTE, dst_len);
1151 if (dst_buf == NULL) { 1151 if (dst_buf == NULL) {
1152 return FALSE; 1152 return FALSE;
1153 } 1153 }
1154 FXSYS_memset32(dst_buf, 0, dst_len); 1154 FXSYS_memset32(dst_buf, 0, dst_len);
1155 FXSYS_memcpy32(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader)); 1155 FXSYS_memcpy32(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader));
1156 gif_ptr->cur_offset += sizeof(GifHeader); 1156 gif_ptr->cur_offset += sizeof(GifHeader);
1157 _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->width); 1157 _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->width);
1158 gif_ptr->cur_offset += 2; 1158 gif_ptr->cur_offset += 2;
1159 _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->height); 1159 _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->height);
1160 gif_ptr->cur_offset += 2; 1160 gif_ptr->cur_offset += 2;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 gif_ptr->cur_offset = cur_offset; 1340 gif_ptr->cur_offset = cur_offset;
1341 res = FALSE; 1341 res = FALSE;
1342 } 1342 }
1343 dst_len = gif_ptr->cur_offset; 1343 dst_len = gif_ptr->cur_offset;
1344 dst_buf[dst_len - 1] = GIF_SIG_TRAILER; 1344 dst_buf[dst_len - 1] = GIF_SIG_TRAILER;
1345 if (res) { 1345 if (res) {
1346 gif_ptr->frames++; 1346 gif_ptr->frames++;
1347 } 1347 }
1348 return res; 1348 return res;
1349 } 1349 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/lbmp/fx_bmp.cpp ('k') | core/src/fxcrt/fx_basic_memmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698