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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page.cpp

Issue 1435473004: Prevent buffer underflow in CPDF_TextObject::CalcPositionData (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comment Created 5 years, 1 month 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 "pageint.h" 7 #include "pageint.h"
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_page.h" 10 #include "core/include/fpdfapi/fpdf_page.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 CPDF_Font* pFont = m_TextState.GetFont(); 402 CPDF_Font* pFont = m_TextState.GetFont();
403 FX_BOOL bVertWriting = FALSE; 403 FX_BOOL bVertWriting = FALSE;
404 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); 404 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
405 if (pCIDFont) { 405 if (pCIDFont) {
406 bVertWriting = pCIDFont->IsVertWriting(); 406 bVertWriting = pCIDFont->IsVertWriting();
407 } 407 }
408 FX_FLOAT fontsize = m_TextState.GetFontSize(); 408 FX_FLOAT fontsize = m_TextState.GetFontSize();
409 for (int i = 0; i < m_nChars; ++i) { 409 for (int i = 0; i < m_nChars; ++i) {
410 FX_DWORD charcode = 410 FX_DWORD charcode =
411 m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; 411 m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i];
412 if (charcode == (FX_DWORD)-1) { 412 if (i > 0) {
413 curpos -= FXSYS_Mul(m_pCharPos[i - 1], fontsize) / 1000; 413 if (charcode == (FX_DWORD)-1) {
414 continue; 414 curpos -= FXSYS_Mul(m_pCharPos[i - 1], fontsize) / 1000;
415 } 415 continue;
416 if (i) { 416 }
417 m_pCharPos[i - 1] = curpos; 417 m_pCharPos[i - 1] = curpos;
418 } 418 }
419 FX_RECT char_rect; 419 FX_RECT char_rect;
420 pFont->GetCharBBox(charcode, char_rect, level); 420 pFont->GetCharBBox(charcode, char_rect, level);
421 FX_FLOAT charwidth; 421 FX_FLOAT charwidth;
422 if (!bVertWriting) { 422 if (!bVertWriting) {
423 if (min_y > char_rect.top) { 423 if (min_y > char_rect.top) {
424 min_y = (FX_FLOAT)char_rect.top; 424 min_y = (FX_FLOAT)char_rect.top;
425 } 425 }
426 if (max_y < char_rect.top) { 426 if (max_y < char_rect.top) {
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 (FX_FLOAT)y0); 1006 (FX_FLOAT)y0);
1007 matrix = m_PageMatrix; 1007 matrix = m_PageMatrix;
1008 matrix.Concat(display_matrix); 1008 matrix.Concat(display_matrix);
1009 } 1009 }
1010 CPDF_ParseOptions::CPDF_ParseOptions() { 1010 CPDF_ParseOptions::CPDF_ParseOptions() {
1011 m_bTextOnly = FALSE; 1011 m_bTextOnly = FALSE;
1012 m_bMarkedContent = TRUE; 1012 m_bMarkedContent = TRUE;
1013 m_bSeparateForm = TRUE; 1013 m_bSeparateForm = TRUE;
1014 m_bDecodeInlineImage = FALSE; 1014 m_bDecodeInlineImage = FALSE;
1015 } 1015 }
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