Question
DefineFont2/3 tag parsing bug
mxmlc report a "Unable to create source" error when I tried to<br />embed a swf file into flex application.<br /><br />Following is the stacktrace for this error.<br /><br />java.lang.StringIndexOutOfBoundsException: String index out of range: -1<br /> at java.lang.String.checkBounds(String.java:405)<br /> at java.lang.String.<init>(String.java:450)<br /> at flash.swf.SwfDecoder.readLengthString(SwfDecoder.java:275)<br /> at flash.swf.TagDecoder.decodeDefineFont2And3(TagDecoder.java:770)<br /> at flash.swf.TagDecoder.decodeDefineFont2(TagDecoder.java:737)<br /> ...<br /><br />I think this problem because of swfdecoder parsing font name wrong way.<br /><br />DefineFontInfo tag description in swf file format spec says,<br /> Note that font name strings in the DefineFontInfo tag are not null-terminated;<br /> instead their length is specified by the FontNameLen field.<br /><br />But SwfDecoder#readLengthString() try to remove null-terminator.<br /><br />Attached patch fix this problem.<br />Please entertain the patch.<br /><br />---<br />Sorry about my poor English.<br /><br />INADA Naoki <inada-n@klab.org><br /> K Laboratory, KLab Inc.
