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

Issue 705503004: Change from 'this' to L'this' and remove the cast that was hiding this mismatch. (Closed)

Created:
6 years, 1 month ago by brucedawson
Modified:
6 years, 1 month ago
Reviewers:
Bo Xu, jabdelmalek
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Visibility:
Public.

Description

Change from 'this' to L'this' and remove the cast that was hiding this mismatch. Found by VC++'s /analyze. Warning was: fpdfsdk\src\javascript\js_runtime.cpp(352) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. This mismatch has been there as far back as the history goes (to May of this year). It looks like a real bug to me. However I don't know the implications of this bug and why it would not have been noticed at run-time. The code has been this way as far back as the git history goes, but that is only to May 2014. Original patch from Bruce Dawson(brucedawson@chromium.org) BUG=427616

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M fpdfsdk/src/javascript/JS_Runtime.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 17 (1 generated)
brucedawson
Can you take a look at this?
6 years, 1 month ago (2014-11-08 01:52:37 UTC) #2
Bo Xu
On 2014/11/08 01:52:37, brucedawson wrote: > Can you take a look at this? Thanks brucedawson, ...
6 years, 1 month ago (2014-11-14 00:05:51 UTC) #3
cpu_(ooo_6.6-7.5)
Bo Xu, he is not a chromium committer so I think git cl land would ...
6 years, 1 month ago (2014-11-14 18:34:05 UTC) #4
Bo Xu
On 2014/11/14 18:34:05, cpu wrote: > Bo Xu, he is not a chromium committer so ...
6 years, 1 month ago (2014-11-14 18:46:16 UTC) #5
Bo Xu
On 2014/11/08 01:52:37, brucedawson wrote: > Can you take a look at this? We might ...
6 years, 1 month ago (2014-11-14 21:37:43 UTC) #6
brucedawson
The cast is what allowed this bug to happen in the first place so I ...
6 years, 1 month ago (2014-11-14 21:41:57 UTC) #7
Bo Xu
On 2014/11/14 21:41:57, brucedawson wrote: > The cast is what allowed this bug to happen ...
6 years, 1 month ago (2014-11-14 22:14:40 UTC) #8
brucedawson
Agreed. I don't know if any of the other casts are causing problems (I don't ...
6 years, 1 month ago (2014-11-14 22:22:27 UTC) #9
Bo Xu
On 2014/11/14 22:22:27, brucedawson wrote: > Agreed. I don't know if any of the other ...
6 years, 1 month ago (2014-11-14 23:13:19 UTC) #10
Tom Sepez
Drive-by: Note also the casts on or about line 333 are redundant, and should be ...
6 years, 1 month ago (2014-11-14 23:46:20 UTC) #11
Bo Xu
On 2014/11/14 23:46:20, Tom Sepez wrote: > Drive-by: Note also the casts on or about ...
6 years, 1 month ago (2014-11-14 23:51:23 UTC) #12
Tom Sepez
On 2014/11/14 23:46:20, Tom Sepez wrote: > Drive-by: Note also the casts on or about ...
6 years, 1 month ago (2014-11-14 23:57:06 UTC) #13
Bo Xu
On 2014/11/14 23:57:06, Tom Sepez wrote: > On 2014/11/14 23:46:20, Tom Sepez wrote: > > ...
6 years, 1 month ago (2014-11-15 00:10:13 UTC) #14
brucedawson
I can CR the clean up. Many of the casts can be removed. Those that ...
6 years, 1 month ago (2014-11-15 00:18:28 UTC) #15
Bo Xu
On 2014/11/15 00:18:28, brucedawson wrote: > I can CR the clean up. Many of the ...
6 years, 1 month ago (2014-11-15 00:40:47 UTC) #16
brucedawson
6 years, 1 month ago (2014-11-15 01:25:41 UTC) #17
On 2014/11/15 00:40:47, Bo Xu wrote:
> On 2014/11/15 00:18:28, brucedawson wrote:
> > I can CR the clean up. Many of the casts can be removed. Those that
currently
> > serve a purpose will need to be evaluated to see if there is a better
option.
> > There usually is. In those cases where the cast is there to force a
conversion
> > from CFX_WideString to FX_LPCWSTR it is better (IMHO) to use .Get() to do
the
> > conversion explicitly and avoid the potential for hiding bugs.
> 
> At lease for the wchar_t* literals, we can safely remove the cast, right? I
have
> a patch at https://codereview.chromium.org/726143002/ for this.

Yep, that's good progress.

Powered by Google App Engine
This is Rietveld 408576698