#1000 Images export fails for malformed JPEG3 tags
This is one of the special snowflakes I was referring to in #985. > What steps will reproduce the problem? Attempt to view the swf file attached in GUI, and attempt to export the file in either GUI and CLI. > What is the expected output? What do you see instead? - GUI: Images and their tag info cannot be displayed while shapes and frames containing the images can. However any attempts to export the image will result in an error "Error during export:java.lang.ArrayIndexOutOfBoundsException 0". - CLI: Attempts to export the images via CLI will result in the following error: Jul 24, 2015 9:14:19 PM com.jpexs.decompiler.flash.console.ConsoleAbortRetryIgnoreHandler handle SEVERE: Error occured java.lang.ArrayIndexOutOfBoundsException: 0 at com.jpexs.decompiler.flash.tags.DefineBitsJPEG3Tag.getImage(DefineBitsJPEG3Tag.java:197) at com.jpexs.decompiler.flash.tags.base.ImageTag.getImageData(ImageTag.java:129) at com.jpexs.decompiler.flash.exporters.ImageExporter.lambda$exportImages$11(ImageExporter.j ava:95) at com.jpexs.decompiler.flash.exporters.ImageExporter$$Lambda$13/892529689.run(Unknown Sourc e) at com.jpexs.decompiler.flash.RetryTask.run(RetryTask.java:41) at com.jpexs.decompiler.flash.exporters.ImageExporter.exportImages(ImageExporter.java:102) at com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseExport(CommandLineArgum entParser.java:1326) at com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseArguments(CommandLineAr gumentParser.java:613) at com.jpexs.decompiler.flash.gui.Main.main(Main.java:1179) > What version of the product are you using? Is it "nightly build"? Which operating system do you have? 6.0.1 Stable and nightly 805 > Please provide any additional information below. If the problem is related to a SWF file, attach it here, otherwise we can't help you. The swf file of concern is attached. Notice that Character 5 and 7 are JPEG2 tags and could be viewed and exported normally. I have managed to export the other images using SWFTool's swfextract utility by extracting all JPEG tags and renaming the output files .png. The images retain their transparency so they are probably PNG images stored in JPEG3 tags. I come across user-generated files like this once in a while and I suspect it was caused by a third party flash editor. You mentioned that the SWF specs allow PNG images in JPEG tags; is this file actually compliant?
gbkqnzirjyid.swf (1,287 KiB)
Fixed in the latest nightly (807). Yes, it contains PNG, it is valid, but the bitmapAlphaData is not empty, it has 8 bytes, which is the size of the "compressed" empty data. FFDec not handled this earlier. SWF documentation writes: "BitmapAlphaData UI8[alpha data size] ZLIB compressed array of alpha data. Only supported when tag contains JPEG data. One byte per pixel. Total size after decompression must equal (width * height) of JPEG image." So when there is anything in this property, then it should have width*height bytes in uncompressed format, so probably it is not compliant, but there are lot of other things which is not compliant, but accepted by the official flash player. So now it works with FFDec, too.
Tested nightly 808 and it is working flawlessly now. Thank you. I think this issue can be closed.