summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_crtfileaccess.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-07-20 15:09:19 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-20 19:53:20 +0000
commit3f753f20e9c51f7170a616a355b3f9578505c0ee (patch)
tree5a8e90f1860716003a2d63d37597ff5d592ae84d /core/fxcrt/cfx_crtfileaccess.cpp
parentbba6b77b6b35da6b5884248d768f12615f62a003 (diff)
downloadpdfium-3f753f20e9c51f7170a616a355b3f9578505c0ee.tar.xz
Change length calculation in CFX_StringCTemplate constructor
Originally this would only calculate the length of the passed in string if the passed in length was -1. This causes issues, since other negative values will be passed straight through and break the post-condition on the constructor of the length being non-negative. This leads to undefined and hard to debug behaviour later, in cases where the root cause is a mistake in calculating the proper length. The other related classes, CFX_WideString & CFX_ByteString, test for all negative length values and calculating the length when they occur. This CL changes the FooC versions to use this logic. This implicitly assumes the string is null terminated, so in the incase of an incorrect negative length and a non-null terminated string there will still be a crash, but it will now occur at construction time, instead of at some random later time. BUG=pdfium:827 Change-Id: I4d1fed746ada67c496d8e6ab10861b9332555023 Reviewed-on: https://pdfium-review.googlesource.com/8450 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_crtfileaccess.cpp')
0 files changed, 0 insertions, 0 deletions