subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1519913 - in /subversion/trunk/subversion/bindings/javahl/native: CreateJ.cpp JNIUtil.cpp
Date Wed, 04 Sep 2013 03:58:07 GMT
Author: brane
Date: Wed Sep  4 03:58:06 2013
New Revision: 1519913

URL: http://svn.apache.org/r1519913
Log:
Fix value truncation checks in JavaHL.

* subversion/bindings/javahl/native/CreateJ.cpp
  (CreateJ::ClientNotifyInformation): Check for signed overflow.
* subversion/bindings/javahl/native/JNIUtil.cpp
  (JNIUtil::handleSVNError): Likewise.

Found by: philipm

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=1519913&r1=1519912&r2=1519913&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Wed Sep  4 03:58:06 2013
@@ -858,7 +858,7 @@ CreateJ::ClientNotifyInformation(const s
   jlong jhunkModifiedLength = wcNotify->hunk_modified_length;
   jlong jhunkMatchedLine = wcNotify->hunk_matched_line;
   jint jhunkFuzz = static_cast<jint>(wcNotify->hunk_fuzz);
-  if (jhunkFuzz != wcNotify->hunk_fuzz)
+  if (jhunkFuzz < 0 || jhunkFuzz != wcNotify->hunk_fuzz)
     {
       env->ThrowNew(env->FindClass("java.lang.ArithmeticException"),
                     "Overflow converting C svn_linenum_t to Java int");

Modified: subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1519913&r1=1519912&r2=1519913&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/JNIUtil.cpp Wed Sep  4 03:58:06 2013
@@ -663,7 +663,7 @@ void JNIUtil::handleSVNError(svn_error_t
     POP_AND_RETURN_NOTHING();
 
   const jsize stSize = static_cast<jsize>(newStackTrace.size());
-  if (stSize != newStackTrace.size())
+  if (stSize < 0 || stSize != newStackTrace.size())
     {
       env->ThrowNew(env->FindClass("java.lang.ArithmeticException"),
                     "Overflow converting C size_t to JNI jsize");



Mime
View raw message