GPAC MP4box 2.1-DEV-rev574-g9d5bb184b is vulnerable to Buffer Overflow in gf_text_process_sub function of filters/load_text.c
cpe:2.3:a:gpac:gpac:*:*:*:*:*:*:*:*
B4D3D58A-C3C9-4441-A84A-FB91FD19985C
2.2.0
OR
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/

# Description

Buffer overflow in gf_text_process_sub function of filters/load_text.c

```c
while (szLine[i+1+j] && szLine[i+1+j]!='}') {
	szTime[i] = szLine[i+1+j]; // overflow at szTime
	i++;
}
```

# Version info

```
MP4Box - GPAC version 2.1-DEV-rev574-g9d5bb184b-master
(c) 2000-2022 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: --enable-sanitizer
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB  GPAC_DISABLE_3D
```

# Reproduce

compile and run

```
./configure --enable-sanitizer
make
./MP4Box import -add poc_bof5.avi
```

Crash reported by sanitizer

```
Track Importing Timed Text - Text track 400 x 60 font Serif (size 18) layer 0
[TXTIn] Bad SUB file - expecting "{" got "{"
[TXTIn] corrupted SUB frame (line 2) - ends (at 0 ms) before start of current frame (6 ms) - skipping
filters/load_text.c:2569:10: runtime error: index 20 out of bounds for type 'char [20]'
```

# POC


[poc_bof5.zip](https://github.com/gpac/gpac/files/10202277/poc_bof5.zip)


# Impact

Potentially causing DoS and RCE

# Credit 

Xdchase
Buffer overflow in gf_text_process_sub function of filters/load_text.c
This is a GitHub Issue
repo:gpac
owner:gpac
Title : Buffer overflow in gf_text_process_sub function of filters/load_text.c
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/

# Description

Buffer overflow in gf_text_process_sub function of filters/load_text.c

```c
while (szLine[i+1+j] && szLine[i+1+j]!='}') {
	szTime[i] = szLine[i+1+j]; // overflow at szTime
	i++;
}
```

# Version info

```
MP4Box - GPAC version 2.1-DEV-rev574-g9d5bb184b-master
(c) 2000-2022 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: --enable-sanitizer
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_LINUX_DVB  GPAC_DISABLE_3D
```

# Reproduce

compile and run

```
./configure --enable-sanitizer
make
./MP4Box import -add poc_bof5.avi
```

Crash reported by sanitizer

```
Track Importing Timed Text - Text track 400 x 60 font Serif (size 18) layer 0
[TXTIn] Bad SUB file - expecting "{" got "{"
[TXTIn] corrupted SUB frame (line 2) - ends (at 0 ms) before start of current frame (6 ms) - skipping
filters/load_text.c:2569:10: runtime error: index 20 out of bounds for type 'char [20]'
```

# POC


[poc_bof5.zip](https://github.com/gpac/gpac/files/10202277/poc_bof5.zip)


# Impact

Potentially causing DoS and RCE

# Credit 

Xdchase
--- end body ---

comments :
--- start comments ---

--- end comments ---