Commit 7a5ddbe0 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

CSS rgb(a) parsing: avoid uninitialized-value

We check that the input has at least 5 characters before reading
characters[4].

An rgb(a) color contains at least 3 numbers or percentages,
plus separator characters, so the length of a valid rgb(a) color
will be well over 5.

TBR=nainar@chromium.org
BUG=792306

Change-Id: Iceb49992ee7c5da346e2f64cbc7ccb82ad619f81
Reviewed-on: https://chromium-review.googlesource.com/811784Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522203}
parent 7fe06f0c
...@@ -426,7 +426,7 @@ static inline bool ParseAlphaValue(const CharacterType*& string, ...@@ -426,7 +426,7 @@ static inline bool ParseAlphaValue(const CharacterType*& string,
template <typename CharacterType> template <typename CharacterType>
static inline bool MightBeRGBOrRGBA(const CharacterType* characters, static inline bool MightBeRGBOrRGBA(const CharacterType* characters,
unsigned length) { unsigned length) {
if (length < 4) if (length < 5)
return false; return false;
return IsASCIIAlphaCaselessEqual(characters[0], 'r') && return IsASCIIAlphaCaselessEqual(characters[0], 'r') &&
IsASCIIAlphaCaselessEqual(characters[1], 'g') && IsASCIIAlphaCaselessEqual(characters[1], 'g') &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment