[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: |
Mark Wielaard |
Subject: |
[patch #2951] FileChannelImpl read/write(buff, offset, length) fails when buff.length == 0 |
Date: |
Thu, 29 Apr 2004 17:51:42 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Galeon/1.3.14 (Debian package 1.3.14a-1) |
This mail is an automated notification from the patch tracker
of the project: classpath.
/**************************************************************************/
[patch #2951] Latest Modifications:
Changes by:
Mark Wielaard <address@hidden>
'Date:
Thu 04/29/04 at 21:51 (Europe/Amsterdam)
What | Removed | Added
---------------------------------------------------------------------------
Resolution | None | Fixed
Assigned to | None | mark
Status | Open | Closed
------------------ Additional Follow-up Comments ----------------------------
Thanks. I committed a somewhat similar fix which also fixes another issue with
read(byte[]).
2004-04-29 Stephen Crawley <address@hidden>
Mark Wielaard <address@hidden>
* native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
(Java_gnu_java_nio_channels_FileChannelImpl_read___3BII):
Fill buffer with a do-while bytes_read < 1 loop.
Check for length == 0.
/**************************************************************************/
[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: Fixed
Assigned to: mark
Originator Email:
Status: Closed
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
Follow-up Comments
------------------
-------------------------------------------------------
Date: Thu 04/29/04 at 21:51 By: mark
Thanks. I committed a somewhat similar fix which also fixes another issue with
read(byte[]).
2004-04-29 Stephen Crawley <address@hidden>
Mark Wielaard <address@hidden>
* native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c
(Java_gnu_java_nio_channels_FileChannelImpl_read___3BII):
Fill buffer with a do-while bytes_read < 1 loop.
Check for length == 0.
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/