## Environment
Ubuntu 22.04.3 LTS
## Compiler
clang version 11.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
## Step to reproduce
```cd libming 
./autogen.sh
./configure --disable-shared --disable-freetype
cd util
./swftophp <PoC file>
```
## Contents of PoC file
```
Unzip the file below.
```
[PoC.zip](https://github.com/libming/libming/files/13644168/PoC.zip)
## Expected behavior 
Print error or warning messages handled within swftophp.
## Current behavior
```
header indicates a filesize of 1785358988 but filesize is 232
<?php
$m = new SWFMovie(10);

ming_setscale(1.0);
$m->setRate(81.316406);
$m->setDimension(-5236, -3020);

/* Note: xMin and/or yMin are not 0! */

$m->setFrames(22353);
 Stream out of sync after parse of blocktype 69 (SWF_FILEATTRIBUTES). 26 but expecting 41.
/*Unknown block type 69*/
 Stream out of sync after parse of blocktype 33 (SWF_DEFINETEXT2). 101 but expecting 85.

/* SWF_DEFINETEXT2 */
$character1800 = new SWFText(2);
$character1800->setColor(0x08, 0x08, 0x0a, 0x6a);
outputSWF_TEXT_RECORD: can't process text record: fonts information list is NULL
$character1800->addString("X");
/*Unknown block type 413*/
 Stream out of sync after parse of blocktype 64 (SWF_ENABLEDEBUGGER2). 154 but expecting 144.
/*Unknown block type 64*/
/*Unknown block type 634*/
/*Unknown block type 325*/
/*Unknown block type 353*/
 Stream out of sync after parse of blocktype 41 (SWF_SERIALNUMBER). 231 but expecting 224.

/* SWF_SERIALNUMBER */
sudden file end: read failed @226 fileSize 232, request 30

extra garbage (i.e., we messed up in main): 

0000: 9e 9e 9e 9e 9e 9e                                  ......





	header('Content-type: application/x-shockwave-flash');
$m->output(9);
?>

=================================================================
==1402469==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b50b4013 in readString (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x58013)
    #2 0x55e5b50a817e in parseSWF_ENABLEDEBUGGER2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4c17e)
    #3 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #4 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #5 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #6 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Direct leak of 92 byte(s) in 4 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b50b3f17 in readBytes (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x57f17)
    #2 0x55e5b50b3509 in parseSWF_UNKNOWNBLOCK (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x57509)
    #3 0x55e5b507ef0a in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22f0a)
    #4 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #5 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #6 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7fa2402b4c38 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x55e5b50a741c in parseSWF_DEFINETEXT2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4b41c)
    #2 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #3 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #4 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #5 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b5092499 in parseSWF_TEXTRECORD (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x36499)
    #2 0x55e5b50a7571 in parseSWF_DEFINETEXT2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4b571)
    #3 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #4 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #5 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #6 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 64 byte(s) in 8 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b5091cca in parseSWF_GLYPHENTRY (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x35cca)
    #2 0x55e5b5092528 in parseSWF_TEXTRECORD (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x36528)
    #3 0x55e5b50a7571 in parseSWF_DEFINETEXT2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4b571)
    #4 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #5 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #6 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #7 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 64 byte(s) in 8 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b5091ad1 in parseSWF_GLYPHENTRY (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x35ad1)
    #2 0x55e5b5092528 in parseSWF_TEXTRECORD (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x36528)
    #3 0x55e5b50a7571 in parseSWF_DEFINETEXT2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4b571)
    #4 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #5 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #6 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #7 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 652 byte(s) leaked in 23 allocation(s).
```
Memory leaks in parseSWF_ENABLEDEBUGGER2
This is a GitHub Issue
repo:libming
owner:libming
Title : Memory leaks in parseSWF_ENABLEDEBUGGER2
Issue date:

--- start body ---
## Environment
Ubuntu 22.04.3 LTS
## Compiler
clang version 11.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
## Step to reproduce
```cd libming 
./autogen.sh
./configure --disable-shared --disable-freetype
cd util
./swftophp <PoC file>
```
## Contents of PoC file
```
Unzip the file below.
```
[PoC.zip](https://github.com/libming/libming/files/13644168/PoC.zip)
## Expected behavior 
Print error or warning messages handled within swftophp.
## Current behavior
```
header indicates a filesize of 1785358988 but filesize is 232
<?php
$m = new SWFMovie(10);

ming_setscale(1.0);
$m->setRate(81.316406);
$m->setDimension(-5236, -3020);

/* Note: xMin and/or yMin are not 0! */

$m->setFrames(22353);
 Stream out of sync after parse of blocktype 69 (SWF_FILEATTRIBUTES). 26 but expecting 41.
/*Unknown block type 69*/
 Stream out of sync after parse of blocktype 33 (SWF_DEFINETEXT2). 101 but expecting 85.

/* SWF_DEFINETEXT2 */
$character1800 = new SWFText(2);
$character1800->setColor(0x08, 0x08, 0x0a, 0x6a);
outputSWF_TEXT_RECORD: can't process text record: fonts information list is NULL
$character1800->addString("X");
/*Unknown block type 413*/
 Stream out of sync after parse of blocktype 64 (SWF_ENABLEDEBUGGER2). 154 but expecting 144.
/*Unknown block type 64*/
/*Unknown block type 634*/
/*Unknown block type 325*/
/*Unknown block type 353*/
 Stream out of sync after parse of blocktype 41 (SWF_SERIALNUMBER). 231 but expecting 224.

/* SWF_SERIALNUMBER */
sudden file end: read failed @226 fileSize 232, request 30

extra garbage (i.e., we messed up in main): 

0000: 9e 9e 9e 9e 9e 9e                                  ......





	header('Content-type: application/x-shockwave-flash');
$m->output(9);
?>

=================================================================
==1402469==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 256 byte(s) in 1 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b50b4013 in readString (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x58013)
    #2 0x55e5b50a817e in parseSWF_ENABLEDEBUGGER2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4c17e)
    #3 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #4 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #5 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #6 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Direct leak of 92 byte(s) in 4 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b50b3f17 in readBytes (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x57f17)
    #2 0x55e5b50b3509 in parseSWF_UNKNOWNBLOCK (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x57509)
    #3 0x55e5b507ef0a in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22f0a)
    #4 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #5 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #6 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7fa2402b4c38 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x55e5b50a741c in parseSWF_DEFINETEXT2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4b41c)
    #2 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #3 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #4 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #5 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b5092499 in parseSWF_TEXTRECORD (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x36499)
    #2 0x55e5b50a7571 in parseSWF_DEFINETEXT2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4b571)
    #3 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #4 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #5 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #6 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 64 byte(s) in 8 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b5091cca in parseSWF_GLYPHENTRY (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x35cca)
    #2 0x55e5b5092528 in parseSWF_TEXTRECORD (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x36528)
    #3 0x55e5b50a7571 in parseSWF_DEFINETEXT2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4b571)
    #4 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #5 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #6 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #7 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 64 byte(s) in 8 object(s) allocated from:
    #0 0x7fa2402b4887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55e5b5091ad1 in parseSWF_GLYPHENTRY (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x35ad1)
    #2 0x55e5b5092528 in parseSWF_TEXTRECORD (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x36528)
    #3 0x55e5b50a7571 in parseSWF_DEFINETEXT2 (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x4b571)
    #4 0x55e5b507eee4 in blockParse (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22ee4)
    #5 0x55e5b507e3ca in readMovie (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x223ca)
    #6 0x55e5b507ec3d in main (/home/smb8508/Desktop/work_space/debuging/libming/util/swftophp+0x22c3d)
    #7 0x7fa23fe29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 652 byte(s) leaked in 23 allocation(s).
```
--- end body ---
