summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-02-17 08:53:16 -0800
committerGitHub <noreply@github.com>2023-02-17 08:53:16 -0800
commit7c31110bfd6a82796ae009c1ecc3c9d2b16bbd72 (patch)
tree8a59dec9c69f07ea24b3c33e539da3f7ba2f6687 /src
parente3c923554ce6f586b5fa9fe4fc76cf8780e287b0 (diff)
downloadbinaryen-7c31110bfd6a82796ae009c1ecc3c9d2b16bbd72.tar.gz
binaryen-7c31110bfd6a82796ae009c1ecc3c9d2b16bbd72.tar.bz2
binaryen-7c31110bfd6a82796ae009c1ecc3c9d2b16bbd72.zip
[Strings] Start some basic fuzzing support for strings (#5499)
This is necessary to avoid fuzzer breakage after #5497 as it added a test with strings. We could also ignore that file, like we do for other string files, but this was not much work so just implement it.
Diffstat (limited to 'src')
-rw-r--r--src/tools/fuzzing/fuzzing.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp
index 37de3d1da..4dac794e2 100644
--- a/src/tools/fuzzing/fuzzing.cpp
+++ b/src/tools/fuzzing/fuzzing.cpp
@@ -2116,6 +2116,7 @@ Expression* TranslateToFuzzReader::makeConstBasicRef(Type type) {
return builder.makeArrayInit(trivialArray, {});
}
case HeapType::string:
+ return builder.makeStringConst(std::to_string(upTo(1024)));
case HeapType::stringview_wtf8:
case HeapType::stringview_wtf16:
case HeapType::stringview_iter:
@@ -3224,6 +3225,7 @@ HeapType TranslateToFuzzReader::getSubType(HeapType type) {
case HeapType::array:
return pick(HeapType::array, HeapType::none);
case HeapType::string:
+ return HeapType::string;
case HeapType::stringview_wtf8:
case HeapType::stringview_wtf16:
case HeapType::stringview_iter: