public static void sanityCheck ( int length , byte [ ] frame , int offset ) throws JMFMessageCorruptionException { if ( length < 0 || offset + 4 + length > frame . length ) { JMFMessageCorruptionException jmce = new JMFMessageCorruptionException ( "Bad length: " + HexUtil . toString ( new int [ ] { length } ) + " at offset " + offset ) ; FFDCFilter . processException ( jmce , "com.ibm.ws.sib.mfp.jmf.impl.JSListCoder.sanityCheck" , "160" , Integer . valueOf ( length ) , new Object [ ] { MfpConstants . DM_BUFFER , frame , Integer . valueOf ( 0 ) , Integer . valueOf ( frame . length ) } ) ; throw jmce ; } }
A method to sanity check a 32 bit length value read from the message prior to allocating storage based on the value . The length is not allowed to be negative or to exceed the length of the remaining portion of the message s frame assuming that the length field is immediately followed by the data whose length it is .