Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/

A function `gf_bs_read_long_int` calls itself too many times which causes StackOverflow.

**Version:**

```
MP4Box - GPAC version 1.1.0-DEV-rev1569-g2ace15eff-master
(c) 2000-2021 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io

Please cite our work in your research:
        GPAC Filters: https://doi.org/10.1145/3339825.3394929
        GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: 
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB  GPAC_DISABLE_3D
```

**System information**

```
Ubuntu 20.04 focal AMD EPYC 7742 64-Core @ 16x 2.25GHz
```

** command:**

```sh
./MP4Box -bt ./poc
```

[poc.zip](https://github.com/gpac/gpac/files/7727964/poc.zip)

**Result**

```
[iso file] extra box maxr found in hinf, deleting
[iso file] extra box maxr found in hinf, deleting
[iso file] Unknown box type 80rak in parent moov
[iso file] Incomplete box mdat - start 11495 size 853069
[iso file] Incomplete file while reading for dump - aborting parsing
[iso file] extra box maxr found in hinf, deleting
[iso file] extra box maxr found in hinf, deleting
[iso file] Unknown box type 80rak in parent moov
[iso file] Incomplete box mdat - start 11495 size 853069
[iso file] Incomplete file while reading for dump - aborting parsing
MPEG-4 LASeR Scene Parsing
[LASeR] samepolyXXX coded in bitstream but no polyXXX defined !
[1]    2696197 segmentation fault  ~/raw_gpac/gpac/bin/gcc/MP4Box -bt
```

**GDB**

```
Starting program: /home/surager/raw_gpac/gpac/bin/gcc/MP4Box -bt ./id:000031,sig:11,src:000003,op:flip1,pos:57309
ERROR: Could not find ELF base!
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[iso file] extra box maxr found in hinf, deleting
[iso file] extra box maxr found in hinf, deleting
[iso file] Unknown box type 80rak in parent moov
[iso file] Incomplete box mdat - start 11495 size 853069
[iso file] Incomplete file while reading for dump - aborting parsing
[iso file] extra box maxr found in hinf, deleting
[iso file] extra box maxr found in hinf, deleting
[iso file] Unknown box type 80rak in parent moov
[iso file] Incomplete box mdat - start 11495 size 853069
[iso file] Incomplete file while reading for dump - aborting parsing
MPEG-4 LASeR Scene Parsing
[LASeR] samepolyXXX coded in bitstream but no polyXXX defined !
[LASeR] samepolyXXX coded in bitstream but no polyXXX defined !

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77f5716 in gf_bs_read_long_int () from /home/surager/raw_gpac/gpac/bin/gcc/libgpac.so.10
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
────────────────────────────────────────────────────────────────────────────[ REGISTERS ]─────────────────────────────────────────────────────────────────────────────
 RAX  0x0
 RBX  0x3f
 RCX  0x2010
 RDX  0x3
 RDI  0x5555555d26e0 ◂— 0x0
 RSI  0xe791cba
 R8   0x0
 R9   0x0
 R10  0x7ffff775db40 ◂— 'gf_bs_read_long_int'
 R11  0x7ffff77f5710 (gf_bs_read_long_int) ◂— endbr64 
 R12  0x0
 R13  0x5555555e60e0 —▸ 0x5555555e6100 ◂— 0x8000000300000427
 R14  0x5c
 R15  0x7fffffff62f0 ◂— 0x0
 RBP  0x5555555d26e0 ◂— 0x0
 RSP  0x7fffff7ff000 ◂— 0x0
 RIP  0x7ffff77f5716 (gf_bs_read_long_int+6) ◂— push   rbp
──────────────────────────────────────────────────────────────────────────────[ DISASM ]──────────────────────────────────────────────────────────────────────────────
 ► 0x7ffff77f5716 <gf_bs_read_long_int+6>     push   rbp
   0x7ffff77f5717 <gf_bs_read_long_int+7>     mov    rbp, rdi
   0x7ffff77f571a <gf_bs_read_long_int+10>    push   rbx
   0x7ffff77f571b <gf_bs_read_long_int+11>    cmp    esi, 0x40
   0x7ffff77f571e <gf_bs_read_long_int+14>    jbe    gf_bs_read_long_int+62 <gf_bs_read_long_int+62>
    ↓
   0x7ffff77f574e <gf_bs_read_long_int+62>    xor    eax, eax
   0x7ffff77f5750 <gf_bs_read_long_int+64>    test   esi, esi
   0x7ffff77f5752 <gf_bs_read_long_int+66>    je     gf_bs_read_long_int+57 <gf_bs_read_long_int+57>
    ↓
   0x7ffff77f5749 <gf_bs_read_long_int+57>    pop    rbx
   0x7ffff77f574a <gf_bs_read_long_int+58>    pop    rbp
   0x7ffff77f574b <gf_bs_read_long_int+59>    pop    r12
──────────────────────────────────────────────────────────────────────────────[ STACK ]───────────────────────────────────────────────────────────────────────────────
00:0000│ rsp 0x7fffff7ff000 ◂— 0x0
01:0008│     0x7fffff7ff008 —▸ 0x7ffff77f572d (gf_bs_read_long_int+29) ◂— xor    eax, eax
02:0010│     0x7fffff7ff010 ◂— 0x3f /* '?' */
03:0018│     0x7fffff7ff018 —▸ 0x5555555d26e0 ◂— 0x0
04:0020│     0x7fffff7ff020 ◂— 0x0
05:0028│     0x7fffff7ff028 —▸ 0x7ffff77f572d (gf_bs_read_long_int+29) ◂— xor    eax, eax
06:0030│     0x7fffff7ff030 ◂— 0x3f /* '?' */
07:0038│     0x7fffff7ff038 —▸ 0x5555555d26e0 ◂— 0x0
────────────────────────────────────────────────────────────────────────────[ BACKTRACE ]─────────────────────────────────────────────────────────────────────────────
 ► f 0   0x7ffff77f5716 gf_bs_read_long_int+6
   f 1   0x7ffff77f572d gf_bs_read_long_int+29
   f 2   0x7ffff77f572d gf_bs_read_long_int+29
   f 3   0x7ffff77f572d gf_bs_read_long_int+29
   f 4   0x7ffff77f572d gf_bs_read_long_int+29
   f 5   0x7ffff77f572d gf_bs_read_long_int+29
   f 6   0x7ffff77f572d gf_bs_read_long_int+29
   f 7   0x7ffff77f572d gf_bs_read_long_int+29
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
```

if I enter the gdb command `bt`, it will print too many message like `f 0   0x7ffff77f5716 gf_bs_read_long_int+6
` above.

StackOverflow caused by recursion in function gf_bs_read_long_int()
This is a GitHub Issue
repo:gpac
owner:gpac
Title : StackOverflow caused by recursion in function gf_bs_read_long_int()
Issue date:

--- start body ---
Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/

A function `gf_bs_read_long_int` calls itself too many times which causes StackOverflow.

**Version:**

```
MP4Box - GPAC version 1.1.0-DEV-rev1569-g2ace15eff-master
(c) 2000-2021 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io

Please cite our work in your research:
        GPAC Filters: https://doi.org/10.1145/3339825.3394929
        GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: 
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB  GPAC_DISABLE_3D
```

**System information**

```
Ubuntu 20.04 focal AMD EPYC 7742 64-Core @ 16x 2.25GHz
```

** command:**

```sh
./MP4Box -bt ./poc
```

[poc.zip](https://github.com/gpac/gpac/files/7727964/poc.zip)

**Result**

```
[iso file] extra box maxr found in hinf, deleting
[iso file] extra box maxr found in hinf, deleting
[iso file] Unknown box type 80rak in parent moov
[iso file] Incomplete box mdat - start 11495 size 853069
[iso file] Incomplete file while reading for dump - aborting parsing
[iso file] extra box maxr found in hinf, deleting
[iso file] extra box maxr found in hinf, deleting
[iso file] Unknown box type 80rak in parent moov
[iso file] Incomplete box mdat - start 11495 size 853069
[iso file] Incomplete file while reading for dump - aborting parsing
MPEG-4 LASeR Scene Parsing
[LASeR] samepolyXXX coded in bitstream but no polyXXX defined !
[1]    2696197 segmentation fault  ~/raw_gpac/gpac/bin/gcc/MP4Box -bt
```

**GDB**

```
Starting program: /home/surager/raw_gpac/gpac/bin/gcc/MP4Box -bt ./id:000031,sig:11,src:000003,op:flip1,pos:57309
ERROR: Could not find ELF base!
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[iso file] extra box maxr found in hinf, deleting
[iso file] extra box maxr found in hinf, deleting
[iso file] Unknown box type 80rak in parent moov
[iso file] Incomplete box mdat - start 11495 size 853069
[iso file] Incomplete file while reading for dump - aborting parsing
[iso file] extra box maxr found in hinf, deleting
[iso file] extra box maxr found in hinf, deleting
[iso file] Unknown box type 80rak in parent moov
[iso file] Incomplete box mdat - start 11495 size 853069
[iso file] Incomplete file while reading for dump - aborting parsing
MPEG-4 LASeR Scene Parsing
[LASeR] samepolyXXX coded in bitstream but no polyXXX defined !
[LASeR] samepolyXXX coded in bitstream but no polyXXX defined !

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff77f5716 in gf_bs_read_long_int () from /home/surager/raw_gpac/gpac/bin/gcc/libgpac.so.10
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
────────────────────────────────────────────────────────────────────────────[ REGISTERS ]─────────────────────────────────────────────────────────────────────────────
 RAX  0x0
 RBX  0x3f
 RCX  0x2010
 RDX  0x3
 RDI  0x5555555d26e0 ◂— 0x0
 RSI  0xe791cba
 R8   0x0
 R9   0x0
 R10  0x7ffff775db40 ◂— 'gf_bs_read_long_int'
 R11  0x7ffff77f5710 (gf_bs_read_long_int) ◂— endbr64 
 R12  0x0
 R13  0x5555555e60e0 —▸ 0x5555555e6100 ◂— 0x8000000300000427
 R14  0x5c
 R15  0x7fffffff62f0 ◂— 0x0
 RBP  0x5555555d26e0 ◂— 0x0
 RSP  0x7fffff7ff000 ◂— 0x0
 RIP  0x7ffff77f5716 (gf_bs_read_long_int+6) ◂— push   rbp
──────────────────────────────────────────────────────────────────────────────[ DISASM ]──────────────────────────────────────────────────────────────────────────────
 ► 0x7ffff77f5716 <gf_bs_read_long_int+6>     push   rbp
   0x7ffff77f5717 <gf_bs_read_long_int+7>     mov    rbp, rdi
   0x7ffff77f571a <gf_bs_read_long_int+10>    push   rbx
   0x7ffff77f571b <gf_bs_read_long_int+11>    cmp    esi, 0x40
   0x7ffff77f571e <gf_bs_read_long_int+14>    jbe    gf_bs_read_long_int+62 <gf_bs_read_long_int+62>
    ↓
   0x7ffff77f574e <gf_bs_read_long_int+62>    xor    eax, eax
   0x7ffff77f5750 <gf_bs_read_long_int+64>    test   esi, esi
   0x7ffff77f5752 <gf_bs_read_long_int+66>    je     gf_bs_read_long_int+57 <gf_bs_read_long_int+57>
    ↓
   0x7ffff77f5749 <gf_bs_read_long_int+57>    pop    rbx
   0x7ffff77f574a <gf_bs_read_long_int+58>    pop    rbp
   0x7ffff77f574b <gf_bs_read_long_int+59>    pop    r12
──────────────────────────────────────────────────────────────────────────────[ STACK ]───────────────────────────────────────────────────────────────────────────────
00:0000│ rsp 0x7fffff7ff000 ◂— 0x0
01:0008│     0x7fffff7ff008 —▸ 0x7ffff77f572d (gf_bs_read_long_int+29) ◂— xor    eax, eax
02:0010│     0x7fffff7ff010 ◂— 0x3f /* '?' */
03:0018│     0x7fffff7ff018 —▸ 0x5555555d26e0 ◂— 0x0
04:0020│     0x7fffff7ff020 ◂— 0x0
05:0028│     0x7fffff7ff028 —▸ 0x7ffff77f572d (gf_bs_read_long_int+29) ◂— xor    eax, eax
06:0030│     0x7fffff7ff030 ◂— 0x3f /* '?' */
07:0038│     0x7fffff7ff038 —▸ 0x5555555d26e0 ◂— 0x0
────────────────────────────────────────────────────────────────────────────[ BACKTRACE ]─────────────────────────────────────────────────────────────────────────────
 ► f 0   0x7ffff77f5716 gf_bs_read_long_int+6
   f 1   0x7ffff77f572d gf_bs_read_long_int+29
   f 2   0x7ffff77f572d gf_bs_read_long_int+29
   f 3   0x7ffff77f572d gf_bs_read_long_int+29
   f 4   0x7ffff77f572d gf_bs_read_long_int+29
   f 5   0x7ffff77f572d gf_bs_read_long_int+29
   f 6   0x7ffff77f572d gf_bs_read_long_int+29
   f 7   0x7ffff77f572d gf_bs_read_long_int+29
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
```

if I enter the gdb command `bt`, it will print too many message like `f 0   0x7ffff77f5716 gf_bs_read_long_int+6
` above.

--- end body ---

A StackOverflow vulnerability in the function gf_bs_read_long_int() of GPAC version 1.1.0-DEV can be exploited by providing specially crafted input that causes excessive recursion, leading to a segmentation fault. This can result in a Denial of Service (DoS) condition.