diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-07-20 15:09:19 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-20 19:53:20 +0000 |
commit | 3f753f20e9c51f7170a616a355b3f9578505c0ee (patch) | |
tree | 5a8e90f1860716003a2d63d37597ff5d592ae84d /test | |
parent | bba6b77b6b35da6b5884248d768f12615f62a003 (diff) | |
download | pdfium-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 'test')
0 files changed, 0 insertions, 0 deletions