An issue was discovered in gpac before 1.0.1. The abst_box_read function in box_code_adobe.c has a heap-based buffer over-read.
## System info

Ubuntu x86_64, gcc (Ubuntu 5.5.0-12ubuntu1), MP4Box (latest master [2aa266](https://github.com/gpac/gpac/commit/2aa266dfaab6aaad9f9f4f216ad7d1e62adc7fa0))

## Configure

CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address -ldl" ./configure --static-mp4box

## Command line

./bin/gcc/MP4Box -diso -out /dev/null @@

## AddressSanitizer output

```
=================================================================
==18613==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000e11c at pc 0x7f33b3f553d5 bp 0x7ffd678545b0 sp 0x7ffd67853d58
READ of size 13 at 0x60200000e11c thread T0
    #0 0x7f33b3f553d4 in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x623d4)
    #1 0x559646e8d0b7 in abst_box_read isomedia/box_code_adobe.c:109
    #2 0x559646cffd84 in gf_isom_box_read isomedia/box_funcs.c:1681
    #3 0x559646cffd84 in gf_isom_box_parse_ex isomedia/box_funcs.c:259
    #4 0x559646d01871 in gf_isom_parse_root_box isomedia/box_funcs.c:38
    #5 0x559646d30bf6 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:259
    #6 0x559646d3a6c2 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:247
    #7 0x559646d3a6c2 in gf_isom_open_file isomedia/isom_intern.c:740
    #8 0x559646897b30 in mp4boxMain /home/seviezhou/gpac/applications/mp4box/main.c:5331
    #9 0x7f33b2f1fb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #10 0x55964685e179 in _start (/home/seviezhou/gpac/bin/gcc/MP4Box+0x78179)

0x60200000e11c is located 0 bytes to the right of 12-byte region [0x60200000e110,0x60200000e11c)
allocated by thread T0 here:
    #0 0x7f33b3f8b612 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98612)
    #1 0x559646e895e3 in abst_box_read isomedia/box_code_adobe.c:97

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 strdup
Shadow bytes around the buggy address:
  0x0c047fff9bd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9be0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9bf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9c00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9c10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9c20: fa fa 00[04]fa fa 00 00 fa fa 00 00 fa fa 00 00
  0x0c047fff9c30: fa fa 00 00 fa fa 00 00 fa fa fd fa fa fa 00 fa
  0x0c047fff9c40: fa fa 00 00 fa fa 00 00 fa fa 00 07 fa fa fd fa
  0x0c047fff9c50: fa fa 00 02 fa fa 04 fa fa fa fd fa fa fa 07 fa
  0x0c047fff9c60: fa fa fd fa fa fa 05 fa fa fa fd fa fa fa 00 fa
  0x0c047fff9c70: fa fa fd fa fa fa 07 fa fa fa fd fa fa fa 07 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==18613==ABORTING
```

## POC

[heap-overflow-abst_box_read-box_code_adobe-109.zip](https://github.com/gpac/gpac/files/5038865/heap-overflow-abst_box_read-box_code_adobe-109.zip)

A heap-buffer-overflow in box_code_adobe.c:109
This is a GitHub Issue
repo:gpac
owner:gpac
Title : A heap-buffer-overflow in box_code_adobe.c:109
Issue date:

--- start body ---
## System info

Ubuntu x86_64, gcc (Ubuntu 5.5.0-12ubuntu1), MP4Box (latest master [2aa266](https://github.com/gpac/gpac/commit/2aa266dfaab6aaad9f9f4f216ad7d1e62adc7fa0))

## Configure

CFLAGS="-g -fsanitize=address" LDFLAGS="-fsanitize=address -ldl" ./configure --static-mp4box

## Command line

./bin/gcc/MP4Box -diso -out /dev/null @@

## AddressSanitizer output

```
=================================================================
==18613==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000e11c at pc 0x7f33b3f553d5 bp 0x7ffd678545b0 sp 0x7ffd67853d58
READ of size 13 at 0x60200000e11c thread T0
    #0 0x7f33b3f553d4 in strdup (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x623d4)
    #1 0x559646e8d0b7 in abst_box_read isomedia/box_code_adobe.c:109
    #2 0x559646cffd84 in gf_isom_box_read isomedia/box_funcs.c:1681
    #3 0x559646cffd84 in gf_isom_box_parse_ex isomedia/box_funcs.c:259
    #4 0x559646d01871 in gf_isom_parse_root_box isomedia/box_funcs.c:38
    #5 0x559646d30bf6 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:259
    #6 0x559646d3a6c2 in gf_isom_parse_movie_boxes isomedia/isom_intern.c:247
    #7 0x559646d3a6c2 in gf_isom_open_file isomedia/isom_intern.c:740
    #8 0x559646897b30 in mp4boxMain /home/seviezhou/gpac/applications/mp4box/main.c:5331
    #9 0x7f33b2f1fb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #10 0x55964685e179 in _start (/home/seviezhou/gpac/bin/gcc/MP4Box+0x78179)

0x60200000e11c is located 0 bytes to the right of 12-byte region [0x60200000e110,0x60200000e11c)
allocated by thread T0 here:
    #0 0x7f33b3f8b612 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98612)
    #1 0x559646e895e3 in abst_box_read isomedia/box_code_adobe.c:97

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 strdup
Shadow bytes around the buggy address:
  0x0c047fff9bd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9be0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9bf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9c00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9c10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9c20: fa fa 00[04]fa fa 00 00 fa fa 00 00 fa fa 00 00
  0x0c047fff9c30: fa fa 00 00 fa fa 00 00 fa fa fd fa fa fa 00 fa
  0x0c047fff9c40: fa fa 00 00 fa fa 00 00 fa fa 00 07 fa fa fd fa
  0x0c047fff9c50: fa fa 00 02 fa fa 04 fa fa fa fd fa fa fa 07 fa
  0x0c047fff9c60: fa fa fd fa fa fa 05 fa fa fa fd fa fa fa 00 fa
  0x0c047fff9c70: fa fa fd fa fa fa 07 fa fa fa fd fa fa fa 07 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==18613==ABORTING
```

## POC

[heap-overflow-abst_box_read-box_code_adobe-109.zip](https://github.com/gpac/gpac/files/5038865/heap-overflow-abst_box_read-box_code_adobe-109.zip)

--- end body ---

A heap buffer overflow vulnerability exists in the `abst_box_read` function of `box_code_adobe.c` in GPAC. This vulnerability can be triggered by processing specially crafted input files, leading to potential memory corruption and application crashes. The AddressSanitizer output indicates that the overflow occurs when the function attempts to read beyond the allocated memory, which can be exploited to execute arbitrary code or cause a Denial of Service (DoS).