Fixed: #2304 GFX files truncated

This commit is contained in:
Jindra Petřík
2024-09-22 00:51:49 +02:00
parent 933c89cf06
commit b90eeaa7d0
2 changed files with 5 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- [PR203] AS1/2 extreme lagging
- [#2310] Text search history showing as null
- [#2295], [#2311] AS1/2 p-code freezing on highlighting ConstantPool
- [#2304] GFX files truncated
## [21.0.5] - 2024-09-05
### Fixed
@@ -3557,6 +3558,7 @@ Major version of SWF to XML export changed to 2.
[#2310]: https://www.free-decompiler.com/flash/issues/2310
[#2295]: https://www.free-decompiler.com/flash/issues/2295
[#2311]: https://www.free-decompiler.com/flash/issues/2311
[#2304]: https://www.free-decompiler.com/flash/issues/2304
[#2293]: https://www.free-decompiler.com/flash/issues/2293
[#2294]: https://www.free-decompiler.com/flash/issues/2294
[#2299]: https://www.free-decompiler.com/flash/issues/2299

View File

@@ -2945,7 +2945,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
if (allowUncompressed) {
//In old versions of GFX format (I saw it in 1.02), the fileSize field
// does not contain size of header (signature + version + filesize = 8 bytes)
if (header.gfx && is.available() >= fileSize) {
if (header.gfx && is.available() + 8 > fileSize) {
final InputStream fis = is;
//pass to outputstream all we read
@@ -2972,6 +2972,8 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
int exporterVersion = sis.readUI16("exporterInfo");
if (exporterVersion < 0x200) { //assuming version 2 corrected this
Helper.copyStream(is, os, fileSize - sis.getPos());
} else {
Helper.copyStream(is, os, fileSize - 8 - sis.getPos());
}
} else {
Helper.copyStream(is, os, fileSize - 8 - sis.getPos());