This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: receiveing UDP packets


>>>>> "Michael" == Michael Koch <konqueror@gmx.de> writes:

Michael> Ok to commit to trunk ? This should probably go into 3.4 too ?

Does this fix a regression?  I thought 3.4 was in regressions-only
mode.

Michael>    jbyte *dbytes = elements (p->getData()) + p->getOffset();
Michael> -  jint maxlen = p->maxlen - p->getOffset();

Does it make sense to remove the offset from `maxlen' but keep it for
`dbytes'?  I don't get that.  Plus, don't we want to keep `offset' in
the computation anyway?

Also, it seems to me that we're missing some checking in
DatagramPacket.  At least, the class javadoc claims:

 * Note that for all method below where the buffer length passed by the
 * caller cannot exceed the actually length of the byte array passed as
 * the buffer, if this condition is not true, then the method silently
 * reduces the length value to maximum allowable value.

... but I don't see code to actually implement this.  setLength tries
to throw an exception in this situation (though it may be vulnerable
to wrapping).  So there's at least a little inconsistency.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]