CSP: Harden hash parsing.

Pathalogical cases broke CSP's hash parsing code. This patch adds some
bounds checking to ensure that we don't run off the end of the string
in some edge cases.

BUG=427397

Review URL: https://codereview.chromium.org/700463003

git-svn-id: svn://svn.chromium.org/blink/trunk@184822 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Cleanup a few loops into the new C++11 for-each style.

Inspired by changes in https://codereview.chromium.org/700463003/, this
CL cleans up a few loops where there was an ugly sizeof() calculation
needed. The new C++11 for-each style makes these unnecessary, thus
making the code more readable and less brittle.

R=mkwst@chromium.org

Review URL: https://codereview.chromium.org/680393005

git-svn-id: svn://svn.chromium.org/blink/trunk@184823 bbb929c8-8fbe-4397-9dbb-9b2b20218538