$OpenBSD: patch-libmpdemux_aviheader_c,v 1.1 2006/04/06 21:47:43 biorn Exp $ --- libmpdemux/aviheader.c.orig Thu Apr 6 20:46:29 2006 +++ libmpdemux/aviheader.c Thu Apr 6 20:50:41 2006 @@ -224,11 +224,13 @@ while(1){ print_avisuperindex_chunk(s); - msize = sizeof (uint32_t) * s->wLongsPerEntry * s->nEntriesInUse; - s->aIndex = malloc(msize); - memset (s->aIndex, 0, msize); - s->stdidx = malloc (s->nEntriesInUse * sizeof (avistdindex_chunk)); - memset (s->stdidx, 0, s->nEntriesInUse * sizeof (avistdindex_chunk)); + //// Check and fix this useless crap + if(s->wLongsPerEntry != sizeof (avisuperindex_entry)/4) { + mp_msg (MSGT_HEADER, MSGL_WARN, "Broken super index chunk size: %u\n",s->wLongsPerEntry); + s->wLongsPerEntry = sizeof(avisuperindex_entry)/4; + } + s->aIndex = calloc(s->nEntriesInUse, sizeof (avisuperindex_entry)); + s->stdidx = calloc(s->nEntriesInUse, sizeof (avistdindex_chunk)); // now the real index of indices for (i=0; inEntriesInUse; i++) {