]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[fuzzer] Fix FUZZ_seed()
authorNick Terrell <terrelln@fb.com>
Thu, 14 Sep 2017 01:41:32 +0000 (18:41 -0700)
committerNick Terrell <terrelln@fb.com>
Thu, 14 Sep 2017 01:41:32 +0000 (18:41 -0700)
tests/fuzz/fuzz_helpers.h

index d93881c80df4152090f45eb1685b2a96c357c79d..cb3421bb8f13358ce598e64a6a03b095d1646a25 100644 (file)
@@ -55,10 +55,11 @@ extern "C" {
  * Consumes up to the first FUZZ_RNG_SEED_SIZE bytes of the input.
  */
 FUZZ_STATIC uint32_t FUZZ_seed(uint8_t const **src, size_t* size) {
+  uint8_t const *data = *src;
   size_t const toHash = MIN(FUZZ_RNG_SEED_SIZE, *size);
-  return XXH32(*src, toHash, 0);
   *size -= toHash;
   *src += toHash;
+  return XXH32(data, toHash, 0);
 }
 
 #define FUZZ_rotl32(x, r) (((x) << (r)) | ((x) >> (32 - (r))))