Account for string terminator added to FPDFText_GetText strings
The documentation for this function in PDFium explictly calls out that the caller needs to pass in a buffer that is number of characters desired + 1, to account for the terminator. The existing implementation does not correctly do this, grabbing count characters instead of count - 1 characters. This causes the written out string to be count + 1 long due to an added terminator. The corrected implementation cannot be rolled in current, since it causes the strings being returned to be shorter then expected. This CL changes the call sites in Chrome to follow the documentated behaviour, which works correctly with both the old and new implementation of the function. For the old implementation it will overallocate by 1, and for the for the new implementation the allocation size will be correct. BUG=chromium:761770,chromium:761626 Change-Id: I874a88d854c2c85c28847ade3d74bcce56d6a876 Reviewed-on: https://chromium-review.googlesource.com/650650Reviewed-by:dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Cr-Commit-Position: refs/heads/master@{#499732}
Showing
Please register or sign in to comment