changeset 37047:2921fb48ffb9

vf_remove_logo: sanity-check PGM width/height.
author reimar
date Sun, 06 Apr 2014 19:19:07 +0000
parents ce9f83c64515
children 8132b4eef5dc
files libmpcodecs/vf_remove_logo.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_remove_logo.c	Sun Apr 06 19:16:01 2014 +0000
+++ b/libmpcodecs/vf_remove_logo.c	Sun Apr 06 19:19:07 2014 +0000
@@ -553,6 +553,9 @@
   if (maximum_greyscale_value >= 256) REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove_logo: Only 1 byte per pixel (pgm) or 1 byte per color value (ppm) are supported.\n");
   load_pgm_skip(input);
 
+  if (new_pgm->width <= 0 || new_pgm->width > 0x7fff ||
+      new_pgm->height <= 0 || new_pgm->height > 0x7fff)
+    REMOVE_LOGO_LOAD_PGM_ERROR_MESSAGE("[vf]remove_logo: Invalid PGM dimensions.\n");
   image_size = new_pgm->width * new_pgm->height;
   new_pgm->pixel = safe_malloc (image_size);