[vlc-devel] commit: Add bounds checking to crop (Dylan Yudaken )
git version control
git at videolan.org
Tue Apr 28 01:51:13 CEST 2009
vlc | branch: master | Dylan Yudaken <dyudaken at gmail.com> | Mon Apr 27 23:53:16 2009 +0200| [dc0e088df8dde0d0506e9d05fc3a5228fd8560b1] | committer: Jean-Baptiste Kempf
Add bounds checking to crop
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dc0e088df8dde0d0506e9d05fc3a5228fd8560b1
---
src/video_output/vout_intf.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 313ced1..80f23e9 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -1032,6 +1032,13 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
i_crop_top = strtol( psz_end, &psz_end, 10 );
if( *psz_end != '\0' ) goto crop_end;
+ if( i_crop_top + i_crop_height >= p_vout->fmt_render.i_visible_height ||
+ i_crop_left + i_crop_width >= p_vout->fmt_render.i_visible_width )
+ {
+ msg_Err( p_vout, "Unable to crop over picture boundaries");
+ return VLC_EGENERIC;
+ }
+
i_width = i_crop_width;
p_vout->fmt_in.i_visible_width = i_width;
@@ -1062,6 +1069,13 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
i_crop_bottom = strtol( psz_end, &psz_end, 10 );
if( *psz_end != '\0' ) goto crop_end;
+ if( i_crop_top + i_crop_bottom >= p_vout->fmt_render.i_visible_height ||
+ i_crop_right + i_crop_left >= p_vout->fmt_render.i_visible_width )
+ {
+ msg_Err( p_vout, "Unable to crop over picture boundaries" );
+ return VLC_EGENERIC;
+ }
+
i_width = p_vout->fmt_render.i_visible_width
- i_crop_left - i_crop_right;
p_vout->fmt_in.i_visible_width = i_width;
@@ -1087,6 +1101,13 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
i_crop_right = var_GetInteger( p_vout, "crop-right" );
i_crop_bottom = var_GetInteger( p_vout, "crop-bottom" );
+ if( i_crop_top + i_crop_bottom >= p_vout->fmt_render.i_visible_height ||
+ i_crop_right + i_crop_left >= p_vout->fmt_render.i_visible_width )
+ {
+ msg_Err( p_vout, "Unable to crop over picture boundaries" );
+ return VLC_EGENERIC;
+ }
+
i_width = p_vout->fmt_render.i_visible_width
- i_crop_left - i_crop_right;
p_vout->fmt_in.i_visible_width = i_width;
More information about the vlc-devel
mailing list