OSDN Git Service

libdvdread: patch libdvdread malloc bomb
[handbrake-jp/handbrake-jp-git.git] / contrib / libdvdread / A01-check-nr_of_lus.patch
1 diff -Naur libdvdread.orig/src/ifo_read.c libdvdread/src/ifo_read.c
2 --- libdvdread.orig/src/ifo_read.c      2009-01-08 14:57:10.000000000 -0800
3 +++ libdvdread/src/ifo_read.c   2009-06-27 13:22:27.940241400 -0700
4 @@ -1914,6 +1914,13 @@
5    CHECK_VALUE(pgci_ut->nr_of_lus < 100); /* ?? 3-4 ? */
6    CHECK_VALUE((uint32_t)pgci_ut->nr_of_lus * PGCI_LU_SIZE < pgci_ut->last_byte);
7  
8 +  if (pgci_ut->nr_of_lus == 0 || pgci_ut->nr_of_lus >= 100)
9 +  {
10 +    free(pgci_ut);
11 +    ifofile->pgci_ut = 0;
12 +    return 0;
13 +  }
14 +
15    info_length = pgci_ut->nr_of_lus * PGCI_LU_SIZE;
16    data = malloc(info_length);
17    if(!data) {