mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
qt-faststart: add validation on ftyp atom size
avoid trying to allocate an unreasonably sized buffer on corrupt files Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2fc108f60f
commit
ee09ffbfd2
@ -84,6 +84,7 @@
|
||||
|
||||
#define ATOM_PREAMBLE_SIZE 8
|
||||
#define COPY_BUFFER_SIZE 33554432
|
||||
#define MAX_FTYP_ATOM_SIZE 1048576
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -133,6 +134,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* keep ftyp atom */
|
||||
if (atom_type == FTYP_ATOM) {
|
||||
if (atom_size > MAX_FTYP_ATOM_SIZE) {
|
||||
printf("ftyp atom size %"PRIu64" too big\n",
|
||||
atom_size);
|
||||
goto error_out;
|
||||
}
|
||||
ftyp_atom_size = atom_size;
|
||||
free(ftyp_atom);
|
||||
ftyp_atom = malloc(ftyp_atom_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user