Bound the length of phone numbers parsed
Autofill's ParsePhoneNumber parses strings to extract valid phone numbers. This is a considerable effort (including regex matching) and a potential attack surface for malicious inputs. Phone numbers are not arbitrarily long, so exceedingly large inputs for ParsePhoneNumber signal an error or an attack. They are also expensive to parse. Thus, this CL introduces an upper bound on the input length, and the parser will refuse inputs exceeding this bound. As a side effect, the autofill_phone_number_i18n_fuzzer will stop timing out on large inputs. The CL also wraps the phone number unittest in the anonymous namespace: This is to prevent potential name clashes for the newly introduced GenerateTooLongString helper method, but is in general a good thing to do in unittests, which are never meant to be exported beyond their own file. Bug: 901675 Change-Id: Ie3b069f846288ccd7f11fbce98c54669a55f980f Reviewed-on: https://chromium-review.googlesource.com/c/1343007 Commit-Queue: Vaclav Brozek <vabr@chromium.org> Reviewed-by:Roger McFarlane <rogerm@chromium.org> Cr-Commit-Position: refs/heads/master@{#609979}
Showing
Please register or sign in to comment