Fixed SplitStringUsingSubstr to handle empty delimiters
Issue: The base::SplitStringUsingSubstr does not handle the case when the delimiter is empty. The code goes into an infinite loop in that case as begin_index and end_index always stay 0 and we keep on adding empty string pieces to the result. This causes a memory overflow. Fix: This change adds a check for the delimiter size and returns the original input string if the size is 0. Bug: 1062612 Change-Id: I29c184bf18df1bcc50fdb6205a7ff5fa6920148b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108213 Commit-Queue: Siddharth Sharma <siddhash@microsoft.com> Reviewed-by:danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/master@{#751476}
Showing
Please register or sign in to comment