public inbox for frysk-bugzilla@sourceware.org
help / color / mirror / Atom feed
* [Bug general/4679] New: StatelessFile bound checks does not work on 64 bit
@ 2007-06-21  0:40 pmuldoon at redhat dot com
  2007-06-21  1:48 ` [Bug general/4679] " cmoller at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: pmuldoon at redhat dot com @ 2007-06-21  0:40 UTC (permalink / raw)
  To: frysk-bugzilla

The below code won't work as java longs are signed, so values in the upper
address range will be represented as negative decimal numbers for the purposes
of the < 0 decimal comparisons. So a read at 0xffffffffff600000 will fail as
when rendered to a singed long it will be a negative decimal value in the
comparison and the <0 test will fail.

static void
verifyBounds (jlong fileOffset, jbyteArray bytes, jlong start, jlong length)
{

  // XXX: 64-bit?
  if (fileOffset < 0)
    throw new java::lang::ArrayIndexOutOfBoundsException ();
  if (start < 0)
    throw new java::lang::ArrayIndexOutOfBoundsException ();
  if (length < 0)
    throw new java::lang::ArrayIndexOutOfBoundsException ();
  if (start + length > bytes->length)
    throw new java::lang::ArrayIndexOutOfBoundsException ();
}

-- 
           Summary: StatelessFile bound checks does not work on 64 bit
           Product: frysk
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: general
        AssignedTo: frysk-bugzilla at sourceware dot org
        ReportedBy: pmuldoon at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4679

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug general/4679] StatelessFile bound checks does not work on 64 bit
  2007-06-21  0:40 [Bug general/4679] New: StatelessFile bound checks does not work on 64 bit pmuldoon at redhat dot com
@ 2007-06-21  1:48 ` cmoller at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: cmoller at redhat dot com @ 2007-06-21  1:48 UTC (permalink / raw)
  To: frysk-bugzilla


------- Additional Comments From cmoller at redhat dot com  2007-06-21 01:48 -------
Removed verifyBounds()in StatelessFile.java, replaced it with an upper-bound
check, and comitted it.  (Nominally negative signed start and length numbers
interpreted as large unsigned numbers will exceed bytes->length and cause a
bounds exception.  A nominally negative signed fileOffset number interpreted as
a large unsigned value will /probably/ result in a read error and a throwErrno().)

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|frysk-bugzilla at sourceware|cmoller at redhat dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=4679

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-21  1:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-21  0:40 [Bug general/4679] New: StatelessFile bound checks does not work on 64 bit pmuldoon at redhat dot com
2007-06-21  1:48 ` [Bug general/4679] " cmoller at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).