]> git.sesse.net Git - vlc/commit
block: Fix buffer total size in block_Alloc()
authorCasian Andrei <skeletk13@gmail.com>
Sat, 5 May 2012 16:42:54 +0000 (19:42 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 5 May 2012 17:23:01 +0000 (20:23 +0300)
commita5ebee89e06ed57ede6cf91641dc7c1d3c638fcb
tree633ffba966ff4dea68e2e3a2a6bb51a34051179a
parent2d2cde172f10a5290956a115b35cf693a945e559
block: Fix buffer total size in block_Alloc()

The total size of the buffer (i_size) was initialized with the whole
allocated size for the block. This fooled block_Realloc() in the case of
resizing to slightly larger, with the extra size in range from
32 to 32 + 80 bytes. block_Realloc() assumed it had enough space left in
the buffer padding to avoid reallocating memory.

Consequently, the block ended up with a i_buffer field with a value
larger than the allocated memory around p_buffer.

In the end, this could cause memory corruptions in all sorts of cases.
In my case, vlc was crashing while encoutering a corrupted mp3 file.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
src/misc/block.c