Eleriseth at 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 at 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,...).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20110310/279d2e3d/attachment.pgp>

Reply via email to