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: natPlainDatagramSocketImplXXXX.cc offset bug.


Am Sonntag, 21. März 2004 20:14 schrieb Norbert Frese:
> This patch fixes a buffer-offset related bug in
> natPlainDatagramSocketImplPosix.cc and
> natPlainDatagramSocketImplWin32.cc.
>
> With this patch all the Mauve
> gnu.testlet.java.net.DatagramPacket.DatagramPacketOffset tests
> pass.
>
> Norbert
>
>
> 2004-03-21 Norbert Frese <postfach@nfrese.net>
>
> 	* gnu/java/net/natPlainDatagramSocketImplPosix.cc
> 	(peekData): Do not subtract buffer offset from maxlen.
> 	(receive): Likewise.
> 	* gnu/java/net/natPlainDatagramSocketImplWin32.cc
> 	(peekData): Do not subtract buffer offset from maxlen.
> 	(receive): Likewise
>
>
> Index: gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc
> ===================================================================
> RCS file:
> /cvs/gcc/gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc,
>vretrieving revision 1.7 diff -u -r1.7
> natPlainDatagramSocketImplPosix.cc
> --- gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc 17
> Mar 2004 08:10:28 -0000      1.7
> +++ gcc/libjava/gnu/java/net/natPlainDatagramSocketImplPosix.cc 21
> Mar 2004 18:10:09 -0000
> @@ -210,7 +210,7 @@
>    union SockAddr u;
>    socklen_t addrlen = sizeof(u);
>    jbyte *dbytes = elements (p->getData()) + p->getOffset();
> -  jint maxlen = p->maxlen - p->getOffset();
> +  jint maxlen = p->maxlen; // Max bytes starting from offset.
>    ssize_t retlen = 0;
>
>    // Do timeouts via select since SO_RCVTIMEO is not always
> available. @@ -335,7 +335,7 @@
>    union SockAddr u;
>    socklen_t addrlen = sizeof(u);
>    jbyte *dbytes = elements (p->getData()) + p->getOffset();
> -  jint maxlen = p->maxlen - p->getOffset();
> +  jint maxlen = p->maxlen;  // Max bytes starting from offset.
>    ssize_t retlen = 0;
>
>    // Do timeouts via select since SO_RCVTIMEO is not always
> available. Index:
> gcc/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc
> ===================================================================
> RCS file:
> /cvs/gcc/gcc/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc,
>vretrieving revision 1.8 diff -u -r1.8
> natPlainDatagramSocketImplWin32.cc
> --- gcc/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc 17
> Mar 2004 08:10:28 -0000      1.8
> +++ gcc/libjava/gnu/java/net/natPlainDatagramSocketImplWin32.cc 21
> Mar 2004 18:10:10 -0000
> @@ -202,7 +202,7 @@
>    union SockAddr u;
>    socklen_t addrlen = sizeof(u);
>    jbyte *dbytes = elements (p->getData()) + p->getOffset();
> -  jint maxlen = p->maxlen - p->getOffset();
> +  jint maxlen = p->maxlen; // Max bytes starting from offset.
>    ssize_t retlen = 0;
>
>    if (timeout > 0)
> @@ -321,7 +321,7 @@
>    union SockAddr u;
>    socklen_t addrlen = sizeof(u);
>    jbyte *dbytes = elements (p->getData()) + p->getOffset();
> -  jint maxlen = p->maxlen - p->getOffset();
> +  jint maxlen = p->maxlen; // Max bytes starting from offset.
>    ssize_t retlen = 0;
>
>    if (timeout > 0)

What about the code changes I proposed ?


Michael


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