当前位置:首页 » Android开发技术

[Android]Native Crash at vdc

2015-09-23 11:41 本站整理 浏览(27)

問題:Android 5.1 上,在SD card 中用 file commander apk 打開長文件名,再關閉時會發生 nativer crash。

Current Executing Process: /system/bin/vdc

Backtrace: /system/bin/vdc

#00 pc 000000000005fb3c /system/lib64/libc.so (tgkill+8)

#01 pc 00000000000202b4 /system/lib64/libc.so (pthread_kill+160)

#02 pc 00000000000217e8 /system/lib64/libc.so (raise+28)

#03 pc 000000000001b17c /system/lib64/libc.so (abort+60)

#04 pc 00000000000013c4 /system/bin/vdc

#05 pc 0000000000000f28 /system/bin/vdc (main+232)

#06 pc 0000000000019b3c /system/lib64/libc.so (__libc_init+100)

#07 pc 0000000000000fa4 /system/bin/vdc

分析,

在 do_cmd 中加 debug log 可以看出,程式執行了CommandListener.cpp 中的命令。

solution:

將 final_cmd 數組 變大,如255調到512就OK了。

static int do_cmd(int sock, int argc, char **argv) {
    char final_cmd[255] = "0 "; /* 0 is a (now required) sequence number */

...

}
改成 PATH_MAX,這裡的值為 1024
static int do_cmd(int sock, int argc, char **argv) {
    char final_cmd[PATH_MAX] = "0 "; /* 0 is a (now required) sequence number */

...
}