[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch #2951] FileChannelImpl read/write(buff, offset, length) fails whe
From: |
Stephen Crawley |
Subject: |
[patch #2951] FileChannelImpl read/write(buff, offset, length) fails when buff.length == 0 |
Date: |
Mon, 19 Apr 2004 11:27:41 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225 |
This mail is an automated notification from the patch tracker
of the project: classpath.
/**************************************************************************/
[patch #2951] Full Item Snapshot:
URL: <http://savannah.gnu.org/patch/?func=detailitem&item_id=2951>
Project: classpath
Submitted by: Stephen Crawley
On: Mon 04/19/04 at 15:27
Category: None
Priority: 5 - Normal
Resolution: None
Assigned to: None
Originator Email:
Status: Open
Summary: FileChannelImpl read/write(buff, offset, length) fails when
buff.length == 0
Original Submission: The current native implementation of the 3 argument read
and write methods of gnu.java.nio.channel.FileChannelImpl
throw an IOException with message "Unexpected JNI error"
when the buff argument has zero length. This can happen
if an application tries to read or write an zero length
byte array with a File{Input,Output}Stream. The problem
is that the native methods don't check the length arg
before making the JNI GetByteArrayElements call. The
latter call then fails ...
The bugs are exercised by these Mauve testcases:
gnu.testlet.java.io.FileOutputStream.write
gnu.testlet.java.io.FileInputStream.read
The obvious fix is to have the native methods test for
length == 0 explicitly. Suggested ChangeLog entries:
2004-04-20 Stephen Crawley <address@hidden>
* native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
(Java_gnu_java_nio_channels_FileChannelImpl_read___3BII) :
check for length == 0
* native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
(Java_gnu_java_nio_channels_FileChannelImpl_write___3BII)
ditto
File Attachments
-------------------
-------------------------------------------------------
Date: Mon 04/19/04 at 15:27 Name: diffs Size: 1KB By: crawley
http://savannah.gnu.org/patch/download.php?item_id=2951&item_file_id=3124
For detailed info, follow this link:
<http://savannah.gnu.org/patch/?func=detailitem&item_id=2951>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [patch #2951] FileChannelImpl read/write(buff, offset, length) fails when buff.length == 0,
Stephen Crawley <=