OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 #include "pdf/pdfium/pdfium_engine.h" | 5 #include "pdf/pdfium/pdfium_engine.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 DeleteFont | 268 DeleteFont |
269 }; | 269 }; |
270 #endif // defined(OS_LINUX) | 270 #endif // defined(OS_LINUX) |
271 | 271 |
272 void OOM_Handler(_OOM_INFO*) { | 272 void OOM_Handler(_OOM_INFO*) { |
273 // Kill the process. This is important for security, since the code doesn't | 273 // Kill the process. This is important for security, since the code doesn't |
274 // NULL-check many memory allocations. If a malloc fails, returns NULL, and | 274 // NULL-check many memory allocations. If a malloc fails, returns NULL, and |
275 // the buffer is then used, it provides a handy mapping of memory starting at | 275 // the buffer is then used, it provides a handy mapping of memory starting at |
276 // address 0 for an attacker to utilize. | 276 // address 0 for an attacker to utilize. |
277 abort(); | 277 abort(); |
278 // Paranoia, just in case. | |
279 *(volatile char*)0 = '\0'; | |
280 } | 278 } |
281 | 279 |
282 OOM_INFO g_oom_info = { | 280 OOM_INFO g_oom_info = { |
283 1, | 281 1, |
284 OOM_Handler | 282 OOM_Handler |
285 }; | 283 }; |
286 | 284 |
287 PDFiumEngine* g_engine_for_unsupported; | 285 PDFiumEngine* g_engine_for_unsupported; |
288 | 286 |
289 void Unsupported_Handler(UNSUPPORT_INFO*, int type) { | 287 void Unsupported_Handler(UNSUPPORT_INFO*, int type) { |
(...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3380 if (page_width > *max_page_width) { | 3378 if (page_width > *max_page_width) { |
3381 *max_page_width = page_width; | 3379 *max_page_width = page_width; |
3382 } | 3380 } |
3383 } | 3381 } |
3384 } | 3382 } |
3385 FPDF_CloseDocument(doc); | 3383 FPDF_CloseDocument(doc); |
3386 return true; | 3384 return true; |
3387 } | 3385 } |
3388 | 3386 |
3389 } // namespace chrome_pdf | 3387 } // namespace chrome_pdf |
OLD | NEW |