Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
103.02k stars 10.01k forks source link

Segmentation fault #4854

Open mnemo9 opened 1 month ago

mnemo9 commented 1 month ago

$ scrcpy  --version
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.30.0 / 2.30.0
 - libavcodec: 58.125.101 / 60.31.102
 - libavformat: 58.68.100 / 60.16.100
 - libavutil: 56.66.100 / 58.29.100
 - libavdevice: 58.12.100 / 60.3.100
 - libusb: - / 1.0.27

$ ltrace scrcpy -d
__asan_init(2, 0x7fff5ed3f988, 0x7fff5ed3f9a0, 0x56149b47b010)                                           = 0
__asan_version_mismatch_check_v8(2, 0x7fff5ed3f988, 0x7fff5ed3f9a0, 0x56149b47b010)                      = 0
__asan_register_globals(0x56149b47dd80, 858, 0x7fff5ed3f9a0, 0x56149b47b010)                             = 0
__asan_init(2, 0x7fff5ed3f988, 0x7fff5ed3f9a0, 0x56149b47b018)                                           = 0
__asan_version_mismatch_check_v8(2, 0x7fff5ed3f988, 0x7fff5ed3f9a0, 0x56149b47b018)                      = 0
__asan_register_globals(0x56149b48b560, 296, 0x7fff5ed3f9a0, 0x56149b47b018)                             = 0
__asan_stack_malloc_6(2144, 0x7fff5ed3f988, 0x7fff5ed3f9a0, 0x56149b47b028)                              = 0x7fa7b0e00000
puts("scrcpy 2.4 <https://github.com/G"...scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
)                                                              = 50
malloc(65)                                                                                               = 0x507000001bb0
malloc(3136)                                                                                             = 0x51f000000080
__asan_stack_malloc_3(416, 2, 0x7fff5ed3f988, 0x507000001bb0)                                            = 0x7fa7b0b00000
getopt_long(2, 0x7fff5ed3f988, "b:defhKm:MnNp:r:s:StvV:w", 0x51f000000080, nil)                          = 100
getopt_long(2, 0x7fff5ed3f988, "b:defhKm:MnNp:r:s:StvV:w", 0x51f000000080, nil)                          = -1
free(0x507000001bb0)                                                                                     = <void>
free(0x51f000000080)                                                                                     = <void>
SDL_LogSetPriority(0, 3, 0, 202)                                                                         = 0x502000007d70
SDL_LogSetPriority(19, 3, 0, 0x7fa7c5413780)                                                             = 0x502000007d90
SDL_LogSetOutputFunction(0x56149b43d800, 0, 0x502000007d70, 1)                                           = 0xff4f61c00fb
av_log_set_callback(0x56149b43f2d0, 0, 0x502000007d70, 1)                                                = 0xff4f61c00fb
SDL_Init(0x4000, 0, 0x502000007d70, 1)                                                                   = 0
__asan_stack_malloc_0(64, 0x519000002880, 0xe424626cda1756d9, 864)                                       = 0x7fa7b0800000
clock_gettime(1, 0x7fa7b0800020, 0x10007fff8000, 0x7fa7b0800000)                                         = 0
jrand48(0x7fa7b0e00480, 0x2c3411a, 5, 6)                                                                 = 0xffffffff8eacbc52
SDL_CreateMutex(0x56149b510280, 0, 0, 0)                                                                 = 0x504000001ad0
SDL_CreateCond(0x56149b510288, 0x7fff5ed3ee74, 0xac2936a2050, 0x7fa7c5413780)                            = 0x504000001b10
SDL_CreateMutex(0x56149b510298, 0, 0xac2936a2051, 0x7fa7c5413780)                                        = 0x504000001b50
SDL_SetHint(0x56149b464c40, 0x56149b45f860, 5, 0x7fa7c5413780)                                           = 1
SDL_SetHint(0x56149b464d20, 0x56149b45f860, 2, 0x5020000085d0)                                           = 1
SDL_SetHint(0x56149b465300, 0x56149b45e020, 2, 0x5020000085f0)                                           = 1
SDL_SetHint(0x56149b4653a0, 0x56149b45e020, 2, 0x502000008610)                                           = 1
SDL_SetHint(0x56149b465460, 0x56149b45e020, 2, 0x502000008630)                                           = 1
SDL_CreateThread(0x56149b4495d0, 0x56149b465520, 0x56149b510180, 0x56149b510180)                         = 0x50b0000003b0
SDL_Init(32, 0x7fff5ed3e4d8, 5, 0x7fa7c52c4c0a <no return ...>
--- SIGCHLD (Child exited) ---
--- SIGCHLD (Child exited) ---
INFO: ADB device found:
INFO:     -->   (usb)  lfyl9dxonvzpk7g6                device  Redmi_Note_8_Pro
INFO:         (tcpip)  192.168.14.100:5555             device  yes
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 142.7 MB/s (69007 bytes in 0.000s)
--- SIGCHLD (Child exited) ---
--- SIGCHLD (Child exited) ---
<... SDL_Init resumed> )                                                                                 = 0
SDL_Init(16, 0x7fa7c89b30e0, 0, 6)                                                                       = 0
SDL_EnableScreenSaver(0x7fa7b0e007f8, 0x7fa7c559af07, 0, 5)                                              = 0
__asan_stack_malloc_1(128, 0x7fa7c559af07, 0, 5)                                                         = 0x7fa7b0900000
SDL_WaitEvent(0x7fa7b0900020, 0, 0x7fa7b0900000, 0xff576118000)                                          = 1
SDL_WaitEvent(0x7fa7b0900020, 0, 0, 0x7fa7b0900020)                                                      = 1
SDL_WaitEvent(0x7fa7b0900020, 0, 0, 0x7fa7b0900020)                                                      = 1
SDL_WaitEvent(0x7fa7b0900020, 0, 0, 0x7fa7b0900020[server] INFO: Device: [Xiaomi] Redmi Redmi Note 8 Pro (Android 11)
 <no return ...>
--- SIGCHLD (Child exited) ---
<... SDL_WaitEvent resumed> )                                                                            = 1
SDL_LogDebug(0, 0x56149b4656a0, 1, 0x7fa7b0900020)                                                       = 0
SDL_CreateMutex(0x56149b5108b0, 2, 5, 4)                                                                 = 0x5040000160d0
SDL_CreateCond(0x56149b5108b8, 0x7fff5ed3ee74, 0xac2936a2116, 0x7fa7c5413780)                            = 0x504000016110
SDL_CreateMutex(0x56149b5108e8, 0, 0xac2936a2117, 0x7fa7c5413780)                                        = 0x504000016150
strdup("lfyl9dxonvzpk7g6")                                                                               = 0x50300001c270
reallocarray(0, 64, 48, 0x56149b510850)                                                                  = 0x51f000005480
SDL_CreateMutex(0x56149b510880, 3072, 0, 0x51f000005480)                                                 = 0x504000016190
SDL_CreateMutex(0x56149b510838, 0x7fff5ed3ee74, 0xac2936a2110, 0x7fa7c5413780)                           = 0x5040000161d0
SDL_CreateCond(0x56149b510840, 0x7fff5ed3ee74, 0xac2936a2107, 0x7fa7c5413780)                            = 0x504000016210
SDL_LogDebug(0, 0x56149b465ac0, 0, 0x7fa7b0e00754)                                                       = 0
SDL_CreateThread(0x56149b41f6a0, 0x56149b465b00, 0x56149b510828, 0x56149b510828)                         = 0x50b0000208b0
SDL_LogDebug(0, 0x56149b465ba0, 0xac2936a2106, 0x7fa7c52c4c0a)                                           = 0
SDL_CreateThread(0x56149b425d40, 0x56149b465be0, 0x56149b510870, 0x56149b510870)                         = 0x50b000020960
av_frame_alloc(0x56149b5103a8, 2, 0, 0)                                                                  = 0x516000001280
av_frame_alloc(0x516000001460, 480, 0xac2936a2075, 0)                                                    = 0x516000001580
SDL_CreateMutex(0x516000001760, 480, 0xac2936a2076, 0)                                                   = 0x504000016250
SDL_CreateMutex(0x56149b5103d0, 0x7fff5ed3ee74, 0xac2936a2077, 0x7fa7c5413780)                           = 0x504000016290
SDL_CreateCond(0x56149b5103d8, 0x7fff5ed3ee74, 0x7fa7b0e002c0, 0x7fa7c5413780)                           = 0x5040000162d0
SDL_CreateWindow(0x56149b510240, 0, 0, 0)                                                                = 0x511000002340
SDL_CreateRenderer(0x511000002340, 0xffffffff, 2, 1)                                                     = 0x517000013f00
SDL_GetRendererInfo(0x517000013f00, 0x7fa7b0e00650, 0xff4f61c00ca, 1)                                    = 0
SDL_LogInfo(0, 0x56149b466240, 0x7fa7c559d8b2, 0x7fa7c559d8b2 <unfinished ...>
fprintf(0x7fa7c54125c0, "%s: %s\n", "INFO", "Renderer: opengl"INFO: Renderer: opengl
)                                          = 23
<... SDL_LogInfo resumed> )                                                                              = 0
strncmp("opengl", "opengl", 6)                                                                           = 0
SDL_GL_GetProcAddress(0x56149b465cc0, 0x7fa7c559d8b2, 0x56149b466280, 6)                                 = 0x7fa7b60046c0
SDL_GL_GetProcAddress(0x56149b465d00, 0, 0, 11)                                                          = 0x7fa7b600f960
SDL_GL_GetProcAddress(0x56149b465d40, 0, 0, 3)                                                           = 0x7fa7b600f9a0
SDL_GL_GetProcAddress(0x56149b465d80, 0, 0, 15)                                                          = 0x7fa7b6001b20
strncmp("4.6.0 NVIDIA 550.54.14", "OpenGL ES ", 10)                                                      = -1
__isoc23_sscanf(0x413920b8, 0x56149b465e00, 0x56149b5102fc, 0x56149b510300)                              = 2
SDL_LogInfo(0, 0x56149b465e40, 0x413920b8, 0 <unfinished ...>
fprintf(0x7fa7c54125c0, "%s: %s\n", "INFO", "OpenGL version: 4.6.0 NVIDIA 550"...INFO: OpenGL version: 4.6.0 NVIDIA 550.54.14
)                       = 45
<... SDL_LogInfo resumed> )                                                                              = 0
SDL_LogInfo(0, 0x56149b465e80, 1, 0 <unfinished ...>
fprintf(0x7fa7c54125c0, "%s: %s\n", "INFO", "Trilinear filtering enabled"INFO: Trilinear filtering enabled
)                               = 34
<... SDL_LogInfo resumed> )                                                                              = 0
getenv("SCRCPY_ICON_PATH")                                                                               = nil
SDL_LogDebug(0, 0x56149b4628c0, 16, 84)                                                                  = 0
strdup("/usr/local/share/icons/hicolor/2"...)                                                            = 0x506000052220
__asan_stack_malloc_5(1344, 0x56149b462940, 55, 46)                                                      = 0x7fa7b0d00000
avformat_alloc_context(0x7fffffffffff, 0x7fa7b0d00000, 0xff576198100, 0)                                 = 0x51700001a480
avformat_open_input(0x7fa7b0d00040, 0x506000052220, 0, 0)                                                = 0
avformat_find_stream_info(0x51700001a480, 0, 1, 57)                                                      = 0
av_find_best_stream(0x51700001a480, 0, 0xffffffff, 0xffffffff)                                           = 0
--- SIGSEGV (Segmentation fault) ---
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2480289==ERROR: AddressSanitizer: SEGV on unknown address 0x0000bfff8000 (pc 0x56149b424e15 bp 0x7fff5ed3ee90 sp 0x7fff5ed3e8e0 T0)
==2480289==The signal is caused by a READ memory access.
    #0 0x56149b424e15  (/usr/local/bin/scrcpy+0x2de15) (BuildId: 8500e180b06c48f520f9c58e2c1d6fcbc6cfb1aa)
    #1 0x56149b425cd2  (/usr/local/bin/scrcpy+0x2ecd2) (BuildId: 8500e180b06c48f520f9c58e2c1d6fcbc6cfb1aa)
    #2 0x56149b435d9f  (/usr/local/bin/scrcpy+0x3ed9f) (BuildId: 8500e180b06c48f520f9c58e2c1d6fcbc6cfb1aa)
    #3 0x7fa7c525eccf  (/usr/lib/libc.so.6+0x29ccf) (BuildId: 0865c4b9ba13e0094e8b45b78dfc7a2971f536d2)
    #4 0x7fa7c525ed89 in __libc_start_main (/usr/lib/libc.so.6+0x29d89) (BuildId: 0865c4b9ba13e0094e8b45b78dfc7a2971f536d2)
    #5 0x56149b415864  (/usr/local/bin/scrcpy+0x1e864) (BuildId: 8500e180b06c48f520f9c58e2c1d6fcbc6cfb1aa)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/usr/local/bin/scrcpy+0x2de15) (BuildId: 8500e180b06c48f520f9c58e2c1d6fcbc6cfb1aa)
==2480289==ABORTING
+++ exited (status 1) +++
rom1v commented 1 month ago

How did you build/install scrcpy and its dependencies?

Please build in debug mode (still with ASAN):

meson setup d -Db_sanitize=address
ninja -Cd

and run:

./run d -d

(I added -d because you passed this argument in your example)