You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Dave Brown <da...@wandisco.com> on 2009/08/04 18:08:06 UTC

[PATCH] issue #2979: SVNAdmin::load passes a null data buffer

[[[
Fix issue #2979: javahl's SVNAdmin::load() sometimes passes a null data 
buffer
to the read() method of the caller's InputInterface.  JNIUtil::makeByteArray
was returning NULL when the requested byte[] length was 0.  This in turn was
provoked by a read(length=0) on the svn_stream_t loading a repository dump.
read(0) is perfectly valid (albeit superfluous), such as when parsing a
property value with length zero.

The fix just returns a byte[] with length 0 as requested from JNIUtil.cpp.

* 
subversion/bindings/javahl/tests/org/tigris/subversion/javahl/SVNAdminTests.java
  (testLoadRepo): Added test for issue 2979
  (testSetRevProp): Improved test, made it actually verify things

* 
subversion/bindings/javahl/tests/org/tigris/subversion/javahl/SVNTests.java
  (OneTest): Tweaked inner class optionally not to load sample files into
  the test repository.  Keep behavior expected by existing tests.

* subversion/bindings/javahl/tests/data/issue2979.dump
  Data for reproducible test case of issue #2979.  1400 bytes on disk.  If
  there's an objection to checking in test data as a separate file, I could
  boil down a smaller bit of repro data in a String literal in the test 
file.
  I really just need a zero-length prop value in a dump file.

* subversion/bindings/javahl/native/JNIUtil.cpp
  (makeJByteArray) Do not treat byte[0] and NULL as equivalent.
]]]

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2380112

Re: [PATCH] issue #2979: SVNAdmin::load passes a null data buffer

Posted by Mark Phippard <ma...@gmail.com>.
On Tue, Aug 4, 2009 at 2:08 PM, Dave Brown<da...@wandisco.com> wrote:
> [[[
> Fix issue #2979: javahl's SVNAdmin::load() sometimes passes a null data
> buffer
> to the read() method of the caller's InputInterface.  JNIUtil::makeByteArray
> was returning NULL when the requested byte[] length was 0.  This in turn was
> provoked by a read(length=0) on the svn_stream_t loading a repository dump.
> read(0) is perfectly valid (albeit superfluous), such as when parsing a
> property value with length zero.
>
> The fix just returns a byte[] with length 0 as requested from JNIUtil.cpp.
>
> *
> subversion/bindings/javahl/tests/org/tigris/subversion/javahl/SVNAdminTests.java
>  (testLoadRepo): Added test for issue 2979
>  (testSetRevProp): Improved test, made it actually verify things
>
> *
> subversion/bindings/javahl/tests/org/tigris/subversion/javahl/SVNTests.java
>  (OneTest): Tweaked inner class optionally not to load sample files into
>  the test repository.  Keep behavior expected by existing tests.
>
> * subversion/bindings/javahl/tests/data/issue2979.dump
>  Data for reproducible test case of issue #2979.  1400 bytes on disk.  If
>  there's an objection to checking in test data as a separate file, I could
>  boil down a smaller bit of repro data in a String literal in the test
> file.
>  I really just need a zero-length prop value in a dump file.
>
> * subversion/bindings/javahl/native/JNIUtil.cpp
>  (makeJByteArray) Do not treat byte[0] and NULL as equivalent.
> ]]]

There was an unrelated test improvement included in this patch
(testSetRevProp).  I committed it separately in r38753 with just some
formatting corrections.

The rest was committed in r38754 with formatting corrections.


-- 
Thanks

Mark Phippard
http://markphip.blogspot.com/

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2380618