Codebase list faad2 / 79b9ff9
stszin: add check for allocation error and integer overflow Fixes (the second part of) #49. Fabian Greffrath 3 years ago
1 changed file(s) with 7 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
342342 u32in();
343343 // Number of entries
344344 mp4config.frame.ents = u32in();
345 // fixme error checking
346345 // fixme: check atom size
347346 mp4config.frame.data = malloc(sizeof(*mp4config.frame.data)
348347 * (mp4config.frame.ents + 1));
348
349 if (!mp4config.frame.data)
350 return ERR_FAIL;
351
349352 ofs = 0;
350353 mp4config.frame.data[0] = ofs;
351354 for (cnt = 0; cnt < mp4config.frame.ents; cnt++)
357360 mp4config.frame.maxsize = fsize;
358361
359362 mp4config.frame.data[cnt + 1] = ofs;
363
364 if (ofs < mp4config.frame.data[cnt])
365 return ERR_FAIL;
360366 }
361367
362368 return size;