mirror of
https://github.com/mpv-player/mpv
synced 2025-01-24 16:43:28 +00:00
m_config: check for int16_t offset overflow
For some reason shadow_offset is a int16_t variable (to save some space or something), which means the static part of the entire option list must be below 32KB. This is fine, but still add a check against overflows. (Currently it's 3.6KB. This does not include dynamic allocations like strings.)
This commit is contained in:
parent
7d5133b713
commit
b13bb9fbdd
@ -525,7 +525,9 @@ static void m_config_add_option(struct m_config *config,
|
||||
// The required alignment is unknown, so go with the maximum C
|
||||
// could require. Slightly wasteful, but not that much.
|
||||
int align = (size - config->shadow_size % size) % size;
|
||||
co.shadow_offset = config->shadow_size + align;
|
||||
int offset = config->shadow_size + align;
|
||||
assert(offset <= INT16_MAX);
|
||||
co.shadow_offset = offset;
|
||||
config->shadow_size = co.shadow_offset + size;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user