Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Issue 423233002: Speculative fix for uninitialized value in CFX_ByteString(). (Closed)

Created:
6 years, 4 months ago by Tom Sepez
Modified:
6 years, 4 months ago
Reviewers:
jun_fang
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Visibility:
Public.

Description

Speculative fix for uninitialized value in CFX_ByteString(). If somehow different length values could be obtained by two successive calls to Doc_getFilePath() (and FieldBrowse() for that matter), and the method is true to the API documentation that says "The return value always indicated number of bytes required for the buffer, even when there is no buffer specified, or the buffer size is less then required", then it is possible to get a returned length describing memory beyond the current buffer. We can make the corresponding JS_docGetFilePath() method more robust against this case by applying better checks to the returned value. This probably is unrelated since ASAN seems to be flagging the corresponding bug as UAF, but doesn't hurt to make things more robust. BUG=392956 R=jun_fang@foxitsoftware.com Committed: https://pdfium.googlesource.com/pdfium/+/0d3b5cc

Patch Set 1 #

Patch Set 2 : Off by one. #

Patch Set 3 : fix compile #

Total comments: 1

Patch Set 4 : whitespace, use nActualLength not nActualLength - 1. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -19 lines) Patch
M fpdfsdk/include/fsdk_mgr.h View 1 2 3 2 chunks +31 lines, -19 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
Tom Sepez
Jun, please review. I'm not sure about the ActualLength -1 usage. The API comment says ...
6 years, 4 months ago (2014-07-29 22:13:38 UTC) #1
jun_fang
On 2014/07/29 22:13:38, Tom Sepez wrote: > Jun, please review. > > I'm not sure ...
6 years, 4 months ago (2014-07-30 00:37:54 UTC) #2
jun_fang
https://codereview.chromium.org/423233002/diff/40001/fpdfsdk/include/fsdk_mgr.h File fpdfsdk/include/fsdk_mgr.h (right): https://codereview.chromium.org/423233002/diff/40001/fpdfsdk/include/fsdk_mgr.h#newcode206 fpdfsdk/include/fsdk_mgr.h:206: if(nRequiredLen <= 0) Need to add a blank here.
6 years, 4 months ago (2014-07-30 00:38:01 UTC) #3
Tom Sepez
> This function is callback function. It depends on the implementation in > applications. So ...
6 years, 4 months ago (2014-07-30 16:47:41 UTC) #4
Tom Sepez
On 2014/07/30 00:38:01, jun_fang wrote: > https://codereview.chromium.org/423233002/diff/40001/fpdfsdk/include/fsdk_mgr.h > File fpdfsdk/include/fsdk_mgr.h (right): > > https://codereview.chromium.org/423233002/diff/40001/fpdfsdk/include/fsdk_mgr.h#newcode206 > ...
6 years, 4 months ago (2014-07-30 16:47:54 UTC) #5
jun_fang
On 2014/07/30 16:47:41, Tom Sepez wrote: > > This function is callback function. It depends ...
6 years, 4 months ago (2014-07-30 16:54:14 UTC) #6
Tom Sepez
> So 0 is totally different with '\0' in ascii code. No it isn't. What ...
6 years, 4 months ago (2014-07-30 16:55:15 UTC) #7
Tom Sepez
On 2014/07/30 16:55:15, Tom Sepez wrote: > > So 0 is totally different with '\0' ...
6 years, 4 months ago (2014-07-30 16:57:18 UTC) #8
jun_fang
On 2014/07/30 16:55:15, Tom Sepez wrote: > > So 0 is totally different with '\0' ...
6 years, 4 months ago (2014-07-30 17:01:35 UTC) #9
Tom Sepez
> but it doesn't work because 0 is not '\0'. Wrong. 0 and '\0' have ...
6 years, 4 months ago (2014-07-30 17:07:40 UTC) #10
jun_fang
On 2014/07/30 17:07:40, Tom Sepez wrote: > > but it doesn't work because 0 is ...
6 years, 4 months ago (2014-07-30 17:12:18 UTC) #11
Tom Sepez
Are you sure? 0 has the ascii value 48 but '\0' has the ascii value ...
6 years, 4 months ago (2014-07-30 17:13:50 UTC) #12
jun_fang
On 2014/07/30 17:13:50, Tom Sepez wrote: > Are you sure? 0 has the ascii value ...
6 years, 4 months ago (2014-07-30 17:50:33 UTC) #13
jun_fang
On 2014/07/30 17:50:33, jun_fang wrote: > On 2014/07/30 17:13:50, Tom Sepez wrote: > > Are ...
6 years, 4 months ago (2014-07-30 17:51:11 UTC) #14
Tom Sepez
6 years, 4 months ago (2014-07-30 20:04:08 UTC) #15
Message was sent while issue was closed.
Committed patchset #4 manually as r0d3b5cc (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698