New issue
Advanced search Search tips

Issue 823374 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Inspect FPDFText_CountRects() usage in chrome_pdf::PDFiumRange::GetScreenRects()

Project Member Reported by thestig@chromium.org, Mar 19 2018

Issue description

This is a follow-up to bug 821305. We should check the FPDFText_CountRects() calls in chrome_pdf::PDFiumRange::GetScreenRects() to make sure they are valid.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Mar 21 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ed224aa6001e266e665c53bccdb506df76f111de

commit ed224aa6001e266e665c53bccdb506df76f111de
Author: Lei Zhang <thestig@chromium.org>
Date: Wed Mar 21 17:33:01 2018

Add some DCHECK in PDFiumRange::GetScreenRects().

Make sure the start index passed to FPDFText_CountRects() is valid.

BUG= 823374 

Change-Id: I5407fa2d169acd71b860322d280fee11536c85bc
Reviewed-on: https://chromium-review.googlesource.com/972678
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544759}
[modify] https://crrev.com/ed224aa6001e266e665c53bccdb506df76f111de/pdf/pdfium/pdfium_range.cc

Cc: thestig@chromium.org
 Issue 826385  has been merged into this issue.
Just load the attached PDF and hit ctrl + A.
826385.pdf
3.6 KB Download
Project Member

Comment 4 by bugdroid1@chromium.org, Mar 28 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/97712e0473907fae23b6fd639d69ab8c987cbcae

commit 97712e0473907fae23b6fd639d69ab8c987cbcae
Author: Lei Zhang <thestig@chromium.org>
Date: Wed Mar 28 22:53:34 2018

Handle 0 char count in PDFiumRange.

Return early since 0 char count means empty rect / text. This avoids
unnecessary FPDFText_CountChars() / FPDFText_GetText() calls, and it
avoids DCHECK failure when FPDFText_CountChars() returns 0.

Also add some DCHECKs to make sure the char count is valid when set.

BUG= 823374 

Change-Id: Ibe3e6abd902d4a4b05333f8667d6edbe9359ff25
Reviewed-on: https://chromium-review.googlesource.com/984893
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546640}
[modify] https://crrev.com/97712e0473907fae23b6fd639d69ab8c987cbcae/pdf/pdfium/pdfium_range.cc

Status: Fixed (was: Assigned)
I'm going to call this fixed for now, since the DCHECK actually caught something. If we find new DCHECK failures, we can reopen / work on the new bugs separately.

Sign in to add a comment