mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-12-01 04:38:35 -05:00
fix: parse AV1 LEB128 sizes in 64 bits instead of shifting an int past its width, fixes #5484
This commit is contained in:
1 parent
8556830515
commit
c15eefbfdc
4 files changed
+73
-15
No files matched your search
@@ -674,3 +674,21 @@ std::string escape_json_string(std::string input) {
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
size_t zm_parse_leb128(const unsigned char *data, size_t max_size, uint32_t &value) {
|
||||
uint64_t result = 0;
|
||||
size_t bytes_read = 0;
|
||||
|
||||
for (size_t i = 0; i < max_size && i < 8; i++) {
|
||||
uint8_t byte = data[i];
|
||||
result |= static_cast<uint64_t>(byte & 0x7F) << (7 * i);
|
||||
bytes_read++;
|
||||
|
||||
if ((byte & 0x80) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
value = static_cast<uint32_t>(result);
|
||||
return bytes_read;
|
||||
}
|
||||
Reference in new issue
Block a user