aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar metamerism <70122622+metamerism@users.noreply.github.com>2020-09-13 03:48:33 +1200
committerGravatar GitHub <noreply@github.com>2020-09-12 08:48:33 -0700
commitc341052c92ace5e9ffc25382559a5b229f56baf7 (patch)
tree4b9f1b8fb847f1de56e2a025129ce580bb0b773e
parent81a82c35abe4bf0e60bd563f5bfcff41d5d58091 (diff)
[openexr] rewind streams between readSingle and readMulti (#4443)
Signed-off-by: Peter Hillman <peter@pedro.kiwi>
-rw-r--r--projects/openexr/openexr_deepscanlines_fuzzer.cc14
-rw-r--r--projects/openexr/openexr_deeptiles_fuzzer.cc16
-rw-r--r--projects/openexr/openexr_scanlines_fuzzer.cc15
3 files changed, 30 insertions, 15 deletions
diff --git a/projects/openexr/openexr_deepscanlines_fuzzer.cc b/projects/openexr/openexr_deepscanlines_fuzzer.cc
index a91671e4..c5b2e4ce 100644
--- a/projects/openexr/openexr_deepscanlines_fuzzer.cc
+++ b/projects/openexr/openexr_deepscanlines_fuzzer.cc
@@ -164,10 +164,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
std::vector<char> buffer = stream.ConsumeRemainingBytes<char>();
const std::string s(buffer.data(), buffer.size());
- StdISStream is;
- is.str(s);
- readFileSingle(is, width, height);
- readFileMulti(is);
+ {
+ StdISStream is;
+ is.str(s);
+ readFileSingle(is, width, height);
+ }
+ {
+ StdISStream is;
+ is.str(s);
+ readFileMulti(is);
+ }
return 0;
}
diff --git a/projects/openexr/openexr_deeptiles_fuzzer.cc b/projects/openexr/openexr_deeptiles_fuzzer.cc
index 27a79fae..f1ec7e60 100644
--- a/projects/openexr/openexr_deeptiles_fuzzer.cc
+++ b/projects/openexr/openexr_deeptiles_fuzzer.cc
@@ -165,12 +165,16 @@ static void readFileMulti(IStream& is) {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
const std::string s(reinterpret_cast<const char*>(data), size);
- StdISStream is;
- is.str(s);
-
Header::setMaxImageSize(10000, 10000);
- readFileSingle(is);
- readFileMulti(is);
-
+ {
+ StdISStream is;
+ is.str(s);
+ readFileSingle(is);
+ }
+ {
+ StdISStream is;
+ is.str(s);
+ readFileMulti(is);
+ }
return 0;
}
diff --git a/projects/openexr/openexr_scanlines_fuzzer.cc b/projects/openexr/openexr_scanlines_fuzzer.cc
index 8f2d61b9..e41f1f2a 100644
--- a/projects/openexr/openexr_scanlines_fuzzer.cc
+++ b/projects/openexr/openexr_scanlines_fuzzer.cc
@@ -97,10 +97,15 @@ static void readMulti(IStream& is) {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
const std::string s(reinterpret_cast<const char*>(data), size);
- StdISStream is;
- is.str(s);
-
- readSingle(is);
- readMulti(is);
+ {
+ StdISStream is;
+ is.str(s);
+ readSingle(is);
+ }
+ {
+ StdISStream is;
+ is.str(s);
+ readMulti(is);
+ }
return 0;
}