summaryrefslogtreecommitdiff
path: root/skia
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-02-07 21:01:44 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-07 21:01:44 +0000
commit161f992a81e400eeebba49387f174d836750d624 (patch)
tree507d18b7b34344a7b98756318d0cdac0b752fd33 /skia
parenta98e36657d0e5a78e216f828b3e712e85250c1a7 (diff)
downloadpdfium-161f992a81e400eeebba49387f174d836750d624.tar.xz
Handle removed fonts correctly in GetFontByCodePage
The existing code has a couple of issues that need to be addressed. First it assumes that for a hash, there will be an entry in the map and blindly calls the [] operator and takes the address of the result. If there isn't an entry for the hash then this will cause a crash. This has been converted to a call to find and returning nullptr, which is the fail result, if it cannot find an entry for the hash. The other issue is that it assumed that the first entry in the vector would be a valid pointer. When removing fonts from the vector, RemoveFont, first nulls out entries. Once all of the entries have been removed from a vector on subsequent calls to RemoveFont, then the vector is removed from the map. Thus the first entry in the vector might not be the correct value to return. This has been changed to a linear scan of the vector for a valid pointer. BUG=chromium:648177 Change-Id: Ife758636545f0d10fb726c243e3e0a5b7c1d1138 Reviewed-on: https://pdfium-review.googlesource.com/25930 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'skia')
0 files changed, 0 insertions, 0 deletions