From: Alex Gaynor Date: Mon, 29 Jan 2018 12:58:40 +0000 (-0500) Subject: Ensure we initialize a string correctly X-Git-Tag: 7.0.7-23~221 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b9d41ca6956686de2430d0355a1ab6f2d914587;p=imagemagick Ensure we initialize a string correctly Data is not guaranteed to be nul terminated. --- diff --git a/Magick++/fuzz/encoder_xc_fuzzer.cc b/Magick++/fuzz/encoder_xc_fuzzer.cc index 2e6e300fe..049de8d71 100644 --- a/Magick++/fuzz/encoder_xc_fuzzer.cc +++ b/Magick++/fuzz/encoder_xc_fuzzer.cc @@ -9,7 +9,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { // Allow a bit extra to make sure we do proper bounds checking in Magick++ if (Size > MagickPathExtent) return 0; - std::string color(reinterpret_cast(Data)); + std::string color(reinterpret_cast(Data), Size); Magick::Image image; try {