diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b4a8266e..cd6b5bfa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 40c769537..f7b610fd1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -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());