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

Issue 101653007: Fix release mode crash in String::DecodeURI. (Closed)

Created:
7 years ago by Cutch
Modified:
6 years, 11 months ago
Reviewers:
turnidge, siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Fix release mode crash in String::DecodeURI. BUG= Committed: https://code.google.com/p/dart/source/detail?r=31360

Patch Set 1 #

Patch Set 2 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -2 lines) Patch
M runtime/vm/object.cc View 3 chunks +37 lines, -2 lines 2 comments Download

Messages

Total messages: 4 (0 generated)
Cutch
TBR
7 years ago (2013-12-20 23:31:29 UTC) #1
Cutch
Committed patchset #2 manually as r31360 (presubmit successful).
7 years ago (2013-12-20 23:32:17 UTC) #2
siva
https://codereview.chromium.org/101653007/diff/30001/runtime/vm/object.cc File runtime/vm/object.cc (right): https://codereview.chromium.org/101653007/diff/30001/runtime/vm/object.cc#newcode14591 runtime/vm/object.cc:14591: } You seem to always break out of the ...
7 years ago (2013-12-21 00:10:36 UTC) #3
turnidge
6 years, 11 months ago (2014-01-06 20:34:47 UTC) #4
Message was sent while issue was closed.
https://codereview.chromium.org/101653007/diff/30001/runtime/vm/object.cc
File runtime/vm/object.cc (right):

https://codereview.chromium.org/101653007/diff/30001/runtime/vm/object.cc#new...
runtime/vm/object.cc:14591: }
On 2013/12/21 00:10:36, siva wrote:
> You seem to always break out of the while loop if an invalid character is seen
> and then check and return original string on errors.
> 
> Why not just replace all breaks with "return str.raw()" and
> get rid of the local variable 'valid'.

Agree with Siva that the code could be simpler.

I think the code is a bit more readable if we combine all of these tests
together:

  while (cpi.Next()) {
    if (IsPercent(cpi.Current())) {
      if (!cpi.Next() || !IsHexCharacter(cpi.Current()) ||
          !cpi.Next() || !IsHexCharacter(cpi.Current())) {
        return str.raw();
      }
      num_escapes += 2;
    } 
  }

Powered by Google App Engine
This is Rietveld 408576698