Re: [libav-devel] [PATCH] libavcodec/util: Fix timebase overflow check

2016-03-19 Thread Vittorio Giovara
On Wed, Jan 27, 2016 at 5:19 PM, Derek Buitenhuis
 wrote:
> On 1/27/2016 10:16 PM, Luca Barbato wrote:
>> When it is zero? (isn't there a check before to sanitize the time_base ?)
>
> I only see a check for audio.

What happened to this patch?
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] libavcodec/util: Fix timebase overflow check

2016-01-27 Thread Derek Buitenhuis
On 1/27/2016 10:16 PM, Luca Barbato wrote:
> When it is zero? (isn't there a check before to sanitize the time_base ?)

I only see a check for audio.

- Derek
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] libavcodec/util: Fix timebase overflow check

2016-01-27 Thread Luca Barbato
On 27/01/16 22:15, Derek Buitenhuis wrote:
> It could accidentally divide by zero if num was zero.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavcodec/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index e06ee66..a3cb341 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1050,7 +1050,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  if (!avctx->rc_initial_buffer_occupancy)
>  avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 
> 4;
>  
> -if (avctx->ticks_per_frame &&
> +if (avctx->ticks_per_frame && avctx->time_base.num &&
>  avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
>  av_log(avctx, AV_LOG_ERROR,
> "ticks_per_frame %d too large for the timebase %d/%d.",
> 

What about something like

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e06ee66..abad71a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1050,6 +1050,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!avctx->rc_initial_buffer_occupancy)
 avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size
* 3 / 4;

+if (avctx->time_base.num <= 0 ||
+avctx->time_base.den <= 0) {
+av_log(avctx, AV_LOG_ERROR, "Impossible time base %d/%d.",
+   avctx->time_base.num,
+   avctx->time_base.den);
+goto free_and_end;
+}
+
 if (avctx->ticks_per_frame &&
 avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
 av_log(avctx, AV_LOG_ERROR,
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] libavcodec/util: Fix timebase overflow check

2016-01-27 Thread Luca Barbato
On 27/01/16 22:15, Derek Buitenhuis wrote:
> It could accidentally divide by zero if num was zero.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
>  libavcodec/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index e06ee66..a3cb341 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1050,7 +1050,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  if (!avctx->rc_initial_buffer_occupancy)
>  avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 
> 4;
>  
> -if (avctx->ticks_per_frame &&
> +if (avctx->ticks_per_frame && avctx->time_base.num &&
>  avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
>  av_log(avctx, AV_LOG_ERROR,
> "ticks_per_frame %d too large for the timebase %d/%d.",
> 

When it is zero? (isn't there a check before to sanitize the time_base ?)

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] libavcodec/util: Fix timebase overflow check

2016-01-27 Thread Derek Buitenhuis
It could accidentally divide by zero if num was zero.

Signed-off-by: Derek Buitenhuis 
---
 libavcodec/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e06ee66..a3cb341 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1050,7 +1050,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 if (!avctx->rc_initial_buffer_occupancy)
 avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;
 
-if (avctx->ticks_per_frame &&
+if (avctx->ticks_per_frame && avctx->time_base.num &&
 avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
 av_log(avctx, AV_LOG_ERROR,
"ticks_per_frame %d too large for the timebase %d/%d.",
-- 
2.7.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel