Last active
December 23, 2015 00:09
-
-
Save sonOfRa/6552139 to your computer and use it in GitHub Desktop.
Mysterious segfaults
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# A fatal error has been detected by the Java Runtime Environment: | |
# | |
# SIGSEGV (0xb) at pc=0x00007f374472b284, pid=5745, tid=139875359385344 | |
# | |
# JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43) | |
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.0-b56 mixed mode linux-amd64 compressed oops) | |
# Problematic frame: | |
# C [libc.so.6+0x138284] __nss_passwd_lookup+0x166a4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JNIEXPORT jint JNICALL Java_im_tox_jtoxcore_JTox_tox_1addfriend(JNIEnv * env, | |
jobject obj, jlong messenger, jstring address, jstring data) { | |
const uint8_t *_address = (*env)->GetStringUTFChars(env, address, 0); | |
const uint8_t *_data = (*env)->GetStringUTFChars(env, data, 0); | |
uint8_t __address[TOX_FRIEND_ADDRESS_SIZE]; | |
hex_to_addr(_address, __address); | |
printf("beep\n"); | |
fflush(stdout); | |
uint8_t *__data = malloc(strlen(_data) + 1); //Sometimes it segfaults here | |
printf("beep\n"); | |
fflush(stdout); | |
memcpy(__data, _data, strlen(_data) + 1); // If it didn't segfault above, it segfaults here | |
printf("beep\n"); | |
fflush(stdout); | |
(*env)->ReleaseStringUTFChars(env, address, _address); | |
(*env)->ReleaseStringUTFChars(env, data, _data); | |
int ret = tox_addfriend(((tox_jni_globals_t *) messenger)->tox, __address, | |
__data, strlen(__data) + 1); | |
free(__data); | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment