[vlc-devel] [PATCH] gme: fixed out-of-memory/out-of-range tests
Rémi Denis-Courmont
remi at remlab.net
Fri Mar 23 17:49:48 CET 2012
Le vendredi 23 mars 2012 18:15:33 Piotr Fusik, vous avez écrit :
> ---
> modules/demux/gme.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/modules/demux/gme.c b/modules/demux/gme.c
> index 464ba9e..8f56887 100644
> --- a/modules/demux/gme.c
> +++ b/modules/demux/gme.c
> @@ -261,8 +261,8 @@ static int Control (demux_t *demux, int query, va_list
> args)
>
> || (sys->titlev[sys->track_id]->i_length == 0))
>
> break;
>
> - int seek = (sys->titlev[sys->track_id]->i_length / 1000) *
> pos; - if (seek > INT_MAX || gme_seek (sys->emu, seek))
> + double seek = (sys->titlev[sys->track_id]->i_length / 1000) *
> pos;
> + if (seek > INT_MAX || gme_seek (sys->emu, (int) seek))
So signed overflow is undefined. Unsigned would be enough and avoid going to
FPU...
--
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis
More information about the vlc-devel
mailing list