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

Unified Diff: testing/libfuzzer/dictionary_generator.py

Issue 2130463004: [libfuzzer] Fix escaping of quotes in dictionary_generator.py and dicts affected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/libfuzzer/dictionary_generator.py
diff --git a/testing/libfuzzer/dictionary_generator.py b/testing/libfuzzer/dictionary_generator.py
index 7133cfa5c2b078593ddac88805bcdb95d10d9b76..b720e8e755be6442e737663a4ff4f1eb16dd22d9 100755
--- a/testing/libfuzzer/dictionary_generator.py
+++ b/testing/libfuzzer/dictionary_generator.py
@@ -36,7 +36,12 @@ def DecodeHTML(html_data):
def EscapeDictionaryElement(element):
"""Escape all unprintable and control characters in an element."""
- return element.encode('string_escape').replace('"', '\"')
+ element_escaped = element.encode('string_escape')
+ # Remove escaping for single quote because it breaks libFuzzer.
+ element_escaped = element_escaped.replace('\\\'', '\'')
+ # Add escaping for double quote.
+ element_escaped = element_escaped.replace('"', '\\"')
+ return element_escaped
def ExtractWordsFromBinary(filepath, min_length=MIN_STRING_LENGTH):

Powered by Google App Engine
This is Rietveld 408576698