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. 
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). 

Hi,

I built `gpac` twice with `gcc-11 -O0` and `gcc-11 -O3` separately. For the provided input, `MP4Box -dxml` would produce different outputs. Reproduce as follows:
- Compile  `gpac` twice with `gcc-11 -O0` and `gcc-11 -O3` to obtain two versions MP4Box: `MP4Box-O0` and `MP4Box-O3`
- Run `MP4Box-O0 -dxml $issue-2132 -std > out-O0.txt 2>&1` and `MP4Box-O3 -dxml $issue-2132 -std > out-O3.txt 2>&1`
- Compare with `diff -y out-O0.txt out-O3.txt` and you'll see these two files differ (`out-O3.txt` shown on the right has two more lines than `out-O1.txt`) 
[issue-2132.tar.gz](https://github.com/gpac/gpac/files/8190809/issue-2132.tar.gz)

```
<    <!-- NALU number 1 is corrupted: size is 41061584 but only 2 remains -->
---
>    <!-- NALU number 1 is corrupted: size is 0 but only 2 remains -->
124c124
<    <!-- NALU number 1 is corrupted: size is 41061584 but only 2 remains -->
---
>    <!-- NALU number 1 is corrupted: size is 0 but only 2 remains -->
```

I reported a similar bug before (https://github.com/gpac/gpac/issues/2130), which was due to an uninitialized variable. I guess this s might have a similar root cause. I tried to build gpac with clang's MemorySanitizer but failed. `Valgrind` would produce more than a hundred errors on this input. I'm not sure if that's useful or not.
Incorrect result produced by `MP4Box -dxml` 
This is a GitHub Issue
repo:gpac
owner:gpac
Title : Incorrect result produced by `MP4Box -dxml` 
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. 
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). 

Hi,

I built `gpac` twice with `gcc-11 -O0` and `gcc-11 -O3` separately. For the provided input, `MP4Box -dxml` would produce different outputs. Reproduce as follows:
- Compile  `gpac` twice with `gcc-11 -O0` and `gcc-11 -O3` to obtain two versions MP4Box: `MP4Box-O0` and `MP4Box-O3`
- Run `MP4Box-O0 -dxml $issue-2132 -std > out-O0.txt 2>&1` and `MP4Box-O3 -dxml $issue-2132 -std > out-O3.txt 2>&1`
- Compare with `diff -y out-O0.txt out-O3.txt` and you'll see these two files differ (`out-O3.txt` shown on the right has two more lines than `out-O1.txt`) 
[issue-2132.tar.gz](https://github.com/gpac/gpac/files/8190809/issue-2132.tar.gz)

```
<    <!-- NALU number 1 is corrupted: size is 41061584 but only 2 remains -->
---
>    <!-- NALU number 1 is corrupted: size is 0 but only 2 remains -->
124c124
<    <!-- NALU number 1 is corrupted: size is 41061584 but only 2 remains -->
---
>    <!-- NALU number 1 is corrupted: size is 0 but only 2 remains -->
```

I reported a similar bug before (https://github.com/gpac/gpac/issues/2130), which was due to an uninitialized variable. I guess this s might have a similar root cause. I tried to build gpac with clang's MemorySanitizer but failed. `Valgrind` would produce more than a hundred errors on this input. I'm not sure if that's useful or not.
--- end body ---

The issue reported indicates that the `MP4Box -dxml` command produces inconsistent results when compiled with different optimization levels (`-O0` vs `-O3`). This suggests a potential bug in the code, possibly related to uninitialized variables or memory handling, which could lead to incorrect processing of input data. However, it does not directly indicate a security vulnerability, as it primarily concerns functionality and correctness rather than security risks.