[03/10] ape: Don't allow the seektable to be omitted

Message ID 1378932481-98398-3-git-send-email-martin@martin.st
State Committed
Commit 183b9d843a9533774fabd3984a52f3987001acbc
Headers show

Commit Message

Martin Storsjö Sept. 11, 2013, 8:47 p.m.
The seektable is required for filling in ape->frames[i].pos
further down.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
---
 libavformat/ape.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kostya Shishkov Sept. 12, 2013, 4:46 a.m. | #1
On Wed, Sep 11, 2013 at 11:47:54PM +0300, Martin Storsjö wrote:
> The seektable is required for filling in ape->frames[i].pos
> further down.
> 
> Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> CC: libav-stable@libav.org
> ---
>  libavformat/ape.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/ape.c b/libavformat/ape.c
> index 4079947..d967a5d 100644
> --- a/libavformat/ape.c
> +++ b/libavformat/ape.c
> @@ -260,7 +260,7 @@ static int ape_read_header(AVFormatContext * s)
>                 ape->totalframes);
>          return -1;
>      }
> -    if (ape->seektablelength && (ape->seektablelength / sizeof(*ape->seektable)) < ape->totalframes) {
> +    if (ape->seektablelength / sizeof(*ape->seektable) < ape->totalframes) {
>          av_log(s, AV_LOG_ERROR,
>                 "Number of seek entries is less than number of frames: %zu vs. %"PRIu32"\n",
>                 ape->seektablelength / sizeof(*ape->seektable), ape->totalframes);
> -- 

LGTM

Patch

diff --git a/libavformat/ape.c b/libavformat/ape.c
index 4079947..d967a5d 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -260,7 +260,7 @@  static int ape_read_header(AVFormatContext * s)
                ape->totalframes);
         return -1;
     }
-    if (ape->seektablelength && (ape->seektablelength / sizeof(*ape->seektable)) < ape->totalframes) {
+    if (ape->seektablelength / sizeof(*ape->seektable) < ape->totalframes) {
         av_log(s, AV_LOG_ERROR,
                "Number of seek entries is less than number of frames: %zu vs. %"PRIu32"\n",
                ape->seektablelength / sizeof(*ape->seektable), ape->totalframes);