From 4a8dcc0468b21fe5e1b706ade12902b8bba40755 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 30 Aug 2007 19:02:00 +0000 Subject: [PATCH] Avoid a segfault if max_idx has been set before. Fix for bug 256. --- ChangeLog | 6 ++++++ avilib-0.6.10/avilib.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5947d671d..56c11adc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-08-30 Moritz Bunkus + + * avilib: bug fix: Fixed a segmentation fault if reading the first + part of an index failed but a second/other index part is + present. Fix for bug 256. + 2007-08-19 Moritz Bunkus * mkvmerge: enhancement: SRT files that contain coordinates in the diff --git a/avilib-0.6.10/avilib.c b/avilib-0.6.10/avilib.c index 69f2b9e6e..28287f91a 100644 --- a/avilib-0.6.10/avilib.c +++ b/avilib-0.6.10/avilib.c @@ -574,7 +574,7 @@ static int avi_add_index_entry(avi_t *AVI, unsigned char *tag, long flags, unsig { void *ptr; - if(AVI->n_idx>=AVI->max_idx) { + if(!AVI->idx || (AVI->n_idx>=AVI->max_idx)) { ptr = realloc((void *)AVI->idx,(AVI->max_idx+4096)*16); if(ptr == 0) {