1
    memcpy(ints, hashes, (2 * cnt - count) * HASH_SIZE);

    for (i = 2 * cnt - count, j = 2 * cnt - count; j < cnt; i += 2, ++j) {
      cn_fast_hash(hashes[i], 64, ints + j * HASH_SIZE);
    }

Isn't there a buffer overrun? i is going over of size of hashes[].

For example - count=53, cnt=32. At j=26, i=52 buffer overrun.

1 Answer 1

1

Isn't there a buffer overrun? i is going over of size of hashes[].

No, it wont and isn't.

At j=26, i=52 buffer overrun.

No. When j=26, i is 41, so there's no buffer overrun.

2
  • Ok, you are right, thank you. But what will happened with last hashes[52]? Hashes are hashed by pairs, as 64 bytes, will it skipped or doubled somehow?
    – wad
    Commented Feb 6, 2022 at 9:26
  • i never equals 52 in this loop and example.
    – jtgrassie
    Commented Feb 6, 2022 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.