fix potential integer overflow

Multiplication of two `uint32_t` might overflow before it is widened to `uint64_t`
This commit is contained in:
Maks Maltsev 2025-10-07 17:35:08 +03:00 committed by GitHub
parent a144d828cb
commit 816a42c4f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -2460,7 +2460,7 @@ found:
start_sample -= key_prefix; start_sample -= key_prefix;
while (rest < key_prefix) { while (rest < key_prefix) {
trak->prefix += rest * duration; trak->prefix += (uint64_t) rest * duration;
key_prefix -= rest; key_prefix -= rest;
entry--; entry--;
@ -2471,7 +2471,7 @@ found:
rest = count; rest = count;
} }
trak->prefix += key_prefix * duration; trak->prefix += (uint64_t) key_prefix * duration;
trak->duration += trak->prefix; trak->duration += trak->prefix;
rest -= key_prefix; rest -= key_prefix;