Reviewer needed: fixed segfault in IcedTea7-hotspot

Dr Andrew John Hughes ahughes at redhat.com
Tue Aug 2 22:42:50 PDT 2011


On 10:58 Tue 02 Aug     , Pavel Tisnovsky wrote:
> Greetings,
> 
> I'd like to add fix in hotspot code created by Andrew Haley to
> IcedTea7-hotspot.
> 
> Two issues which are corrected by this fix are discussed in following
> thread:
> http://mail.openjdk.java.net/pipermail/hotspot-dev/2011-August/004338.html
> 

I was going to push this myself, so yeah go ahead with the forest update.

I'm in the middle of a bump for the changesets anyway, so I'll handle the IcedTea7
side (the loop fixes and some JDK fixes are waiting to go through).

> 
> Here's ChangeLog entry for IcedTea7-HEAD:
> 
> 2011-08-02  Andrew Haley  <aph at redhat.com>

Irrelevant now, but this seems wrong.  He may have written the
original patch but this is your change to IcedTea7.

> 
>         Fixed two bugs in src/share/vm/runtime/os.cpp
>         which caused random segfaults due to buffer
>         overflow and incorrect usage of int variable
>         instead of char (byte) one.
>         * Makefile.am:
>         (HOTSPOT_CHANGESET): Updated.
>         (HOTSPOT_SHA256SUM): Likewise.
> 
> 
> Can anybody please review this change?
> 
> Thank you in advance,
> Pavel

> diff -r 02ee527cc0ae src/share/vm/runtime/os.cpp
> --- a/src/share/vm/runtime/os.cpp	Fri Jul 29 09:16:29 2011 -0700
> +++ b/src/share/vm/runtime/os.cpp	Tue Aug 02 09:49:20 2011 +0200
> @@ -1298,7 +1298,7 @@
>    size_t sz, i = 0;
>  
>    // read until EOF, EOL or buf is full
> -  while ((sz = (int) read(fd, &buf[i], 1)) == 1 && i < (bsize-1) && buf[i] != '\n') {
> +  while ((sz = (int) read(fd, &buf[i], 1)) == 1 && i < (bsize-2) && buf[i] != '\n') {
>       ++i;
>    }
>  
> @@ -1319,7 +1319,7 @@
>    }
>  
>    // line is longer than size of buf, skip to EOL
> -  int ch;
> +  char ch;
>    while (read(fd, &ch, 1) == 1 && ch != '\n') {
>      // Do nothing
>    }


-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and IcedTea
http://www.gnu.org/software/classpath
http://icedtea.classpath.org
PGP Key: F5862A37 (https://keys.indymedia.org/)
Fingerprint = EA30 D855 D50F 90CD F54D  0698 0713 C3ED F586 2A37



More information about the distro-pkg-dev mailing list