Eleriseth@WPECGLtYbVi8Rl6Y7...
Trust
        Local   Peer
Message                 76
Trust List              
        Re: New freenet-ext.jar, please test! on 2011-03-10 14:07:05    
[Permalink] Reply
Disclaimer: I'm-not-JNI-expert.

toad-notrust@h2RzPS4fEzP0zU43GAfEgxqK2Y55~kEUNR01cWvYApI wrote:
We want to deploy this soon. Please test it.
http://downloads.freenetproject.org/alpha/freenet-ext-v27pre8.jar

You can build this from the tag.

Potential memory leak on error path:

=== cut fec/src/csrc/fec-jinterf.c ===
#define malloc_jthrow(ENV, PTR, TYPE, NUM) \
PTR = (TYPE *) malloc(sizeof(TYPE) * NUM); \
if (PTR == NULL) { \
(*ENV)->ThrowNew(ENV, (*ENV)->FindClass(ENV,
"java/lang/OutOfMemoryError"), "malloc failed"); \
return; \
} \
[...]
/* allocate memory for the arrays */
malloc_jthrow(env, inArr, jbyteArray, k);
malloc_jthrow(env, retArr, jbyteArray, k);
^^ who is going to free inArr here?

malloc_jthrow(env, inarr, jbyte *, k);
same: inArr, retArr
malloc_jthrow(env, retarr, jbyte *, k);
same: inArr, retArr, inarr
[...]
if ((*env)->PushLocalFrame(env, 3+k+numRet) < 0) {
return; /* exception OutOfMemoryError */
^^ who is going to free *all* local arrays here?
}
[...]
jref_null_check(localSrcOff);
same here and a lot of similar code below
[...]
inarr[i] += localSrcOff[i];
potential integer overflow (and out-of-array access)?
=== cut ===
etc, etc, etc.
BTW, general code style guides discourage using such
macros-with-control-statements (goto, return,...).

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Devl mailing list
[email protected]
http://freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to