Closed RaphC closed 6 years ago
One more thing : The computation of paramLength is a bit strange. We use UtilBinaryDecoding.parseShort ,which return a short primitive, whereas the paramLength field is an integer primitive. Is the root cause can be a cast issue ? Does the method UtilBinaryDecoding.parseInt is more appropriate ?
Regards
Hi, thank you for reporting this error and for the investigative work you put into it. I think you are right, something is wrong with the calculation of the parameter size which definitely shouldn't come out negative. I guess it's a overrun of the short primitive. I will look into it and hope that I can fix this bug quick so it will be included the next update on 2nd of July.
Hi,
I'm facing an issue about parsing GDD Structured Field
java.lang.ArrayIndexOutOfBoundsException: -2541 at com.mgz.util.UtilBinaryDecoding.parseShort(UtilBinaryDecoding.java:61) at com.mgz.afp.goca.GDD_GraphicsDataDescriptor.decodeAFP(GDD_GraphicsDataDescriptor.java:54) at com.mgz.afp.parser.AFPParser.parseNextSF(AFPParser.java:128)
The method decodeAfp of the class GDD_GraphicsDataDescriptor, makes a loop on structured data until length is reached. For an unknown reason at the end of the first loop, my param length is -2541 and program try to extract data from structured field with a negative position (my new pos value)
If I check the positive value, the error gone and the field seems correclty parsed. Here is my workaround
I guess the error is located in int paramLength = UtilBinaryDecoding.parseShort(sfData, offset + pos, 2)+1; but I didn't investigate.
FWI, I only have one GDD parameter which is a WindowSpecification instance.
Regards,