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

Side by Side Diff: core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp

Issue 2292473004: Verify element exists before accessing. (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | 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 "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" 7 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 172 }
173 case CPDF_Object::REFERENCE: { 173 case CPDF_Object::REFERENCE: {
174 buf << " " << pObj->AsReference()->GetRefObjNum() << " 0 R "; 174 buf << " " << pObj->AsReference()->GetRefObjNum() << " 0 R ";
175 break; 175 break;
176 } 176 }
177 case CPDF_Object::ARRAY: { 177 case CPDF_Object::ARRAY: {
178 const CPDF_Array* p = pObj->AsArray(); 178 const CPDF_Array* p = pObj->AsArray();
179 buf << "["; 179 buf << "[";
180 for (size_t i = 0; i < p->GetCount(); i++) { 180 for (size_t i = 0; i < p->GetCount(); i++) {
181 CPDF_Object* pElement = p->GetObjectAt(i); 181 CPDF_Object* pElement = p->GetObjectAt(i);
182 if (pElement->GetObjNum()) { 182 if (pElement && pElement->GetObjNum()) {
183 buf << " " << pElement->GetObjNum() << " 0 R"; 183 buf << " " << pElement->GetObjNum() << " 0 R";
184 } else { 184 } else {
185 buf << pElement; 185 buf << pElement;
186 } 186 }
187 } 187 }
188 buf << "]"; 188 buf << "]";
189 break; 189 break;
190 } 190 }
191 case CPDF_Object::DICTIONARY: { 191 case CPDF_Object::DICTIONARY: {
192 const CPDF_Dictionary* p = pObj->AsDictionary(); 192 const CPDF_Dictionary* p = pObj->AsDictionary();
(...skipping 19 matching lines...) Expand all
212 buf.AppendBlock(acc.GetData(), acc.GetSize()); 212 buf.AppendBlock(acc.GetData(), acc.GetSize());
213 buf << "\r\nendstream"; 213 buf << "\r\nendstream";
214 break; 214 break;
215 } 215 }
216 default: 216 default:
217 ASSERT(FALSE); 217 ASSERT(FALSE);
218 break; 218 break;
219 } 219 }
220 return buf; 220 return buf;
221 } 221 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698