Fix JVM segfault during JNI call. Part of [#2647]

Motivation:
Currently when Native.writev(...) is used it is possible to see a JVM segfault because the offset is updated to early.

Modification:
Only update the offset once it is safe to do so.

Result:
No more segfault
This commit is contained in:
Norman Maurer 2014-07-09 13:34:15 +02:00
parent 578068c7e6
commit 6b71089373

View File

@ -761,8 +761,6 @@ JNIEXPORT jlong JNICALL Java_io_netty_channel_epoll_Native_writev(JNIEnv * env,
}
w += res;
offset += loop;
length -= loop;
// update the position of the written buffers
int written = res;
@ -791,6 +789,8 @@ JNIEXPORT jlong JNICALL Java_io_netty_channel_epoll_Native_writev(JNIEnv * env,
}
}
offset += loop;
length -= loop;
}
return w;
}