Closed dankamongmen closed 3 years ago
Interesting. After a good number of resizes using a single-frame image, we get:
Error decoding /home/dank/Perch_Rock_Lighthouse_in_rock_pool.jpg
???
This isn't the easiest thing in the world to reproduce, but it's definitely there, and should definitely be fixed.
Got a log!
==796914== Memcheck, a memory error detector
==796914== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==796914== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==796914== Command: ./ncplayer /home/dank/Perch_Rock_Lighthouse_in_rock_pool.jpg
==796914==
Term: 45x211 vte-256color (VTE with xterm 256-colors)
==796914== Invalid write of size 8
==796914== at 0x483F6D4: memset (vg_replace_strmem.c:1251)
==796914== by 0x487AC4C: init_rvec (render.c:359)
==796914== by 0x487AC4C: engorge_crender_vector (render.c:1171)
==796914== by 0x487AC4C: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb01a20 is 0 bytes after a block of size 371,520 alloc'd
==796914== at 0x483AD7B: realloc (vg_replace_malloc.c:834)
==796914== by 0x487AC2F: engorge_crender_vector (render.c:1165)
==796914== by 0x487AC2F: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
==796914== Invalid write of size 8
==796914== at 0x483F6D7: memset (vg_replace_strmem.c:1251)
==796914== by 0x487AC4C: init_rvec (render.c:359)
==796914== by 0x487AC4C: engorge_crender_vector (render.c:1171)
==796914== by 0x487AC4C: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb01a28 is 8 bytes after a block of size 371,520 alloc'd
==796914== at 0x483AD7B: realloc (vg_replace_malloc.c:834)
==796914== by 0x487AC2F: engorge_crender_vector (render.c:1165)
==796914== by 0x487AC2F: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
==796914== Invalid write of size 8
==796914== at 0x483F6DB: memset (vg_replace_strmem.c:1251)
==796914== by 0x487AC4C: init_rvec (render.c:359)
==796914== by 0x487AC4C: engorge_crender_vector (render.c:1171)
==796914== by 0x487AC4C: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb01a30 is 16 bytes after a block of size 371,520 alloc'd
==796914== at 0x483AD7B: realloc (vg_replace_malloc.c:834)
==796914== by 0x487AC2F: engorge_crender_vector (render.c:1165)
==796914== by 0x487AC2F: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
==796914== Invalid write of size 8
==796914== at 0x483F6DF: memset (vg_replace_strmem.c:1251)
==796914== by 0x487AC4C: init_rvec (render.c:359)
==796914== by 0x487AC4C: engorge_crender_vector (render.c:1171)
==796914== by 0x487AC4C: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb01a38 is 24 bytes after a block of size 371,520 in arena "client"
==796914==
==796914== Invalid write of size 8
==796914== at 0x483F704: memset (vg_replace_strmem.c:1251)
==796914== by 0x487AC4C: init_rvec (render.c:359)
==796914== by 0x487AC4C: engorge_crender_vector (render.c:1171)
==796914== by 0x487AC4C: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb03360 is 6,304 bytes inside a block of size 193,320 free'd
==796914== at 0x48399AB: free (vg_replace_malloc.c:538)
==796914== by 0x68496A2: ??? (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x684AAD3: sws_init_context (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x68A07F9: sws_getCachedContext (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x4C86DE9: ffmpeg_blit(ncvisual*, int, int, ncplane*, blitset const*, int, int, int, int, int, int, bool) (ffmpeg.cpp:480)
==796914== by 0x487F6E2: ncvisual_blit (visual.cpp:22)
==796914== by 0x4880068: ncvisual_render (visual.cpp:513)
==796914== by 0x4C86A9B: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:402)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Block was alloc'd at
==796914== at 0x483AEB8: memalign (vg_replace_malloc.c:906)
==796914== by 0x483AFCE: posix_memalign (vg_replace_malloc.c:1070)
==796914== by 0x6919B14: av_malloc (in /usr/lib/x86_64-linux-gnu/libavutil.so.56.51.100)
==796914== by 0x6919ECD: av_mallocz (in /usr/lib/x86_64-linux-gnu/libavutil.so.56.51.100)
==796914== by 0x6848FCF: ??? (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x684AAD3: sws_init_context (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x68A07F9: sws_getCachedContext (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x4C86DE9: ffmpeg_blit(ncvisual*, int, int, ncplane*, blitset const*, int, int, int, int, int, int, bool) (ffmpeg.cpp:480)
==796914== by 0x487F6E2: ncvisual_blit (visual.cpp:22)
==796914== by 0x4880068: ncvisual_render (visual.cpp:513)
==796914== by 0x4C86A9B: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:402)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
==796914== Invalid write of size 8
==796914== at 0x483F720: memset (vg_replace_strmem.c:1251)
==796914== by 0x487AC4C: init_rvec (render.c:359)
==796914== by 0x487AC4C: engorge_crender_vector (render.c:1171)
==796914== by 0x487AC4C: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb03368 is 6,312 bytes inside a block of size 193,320 free'd
==796914== at 0x48399AB: free (vg_replace_malloc.c:538)
==796914== by 0x68496A2: ??? (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x684AAD3: sws_init_context (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x68A07F9: sws_getCachedContext (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x4C86DE9: ffmpeg_blit(ncvisual*, int, int, ncplane*, blitset const*, int, int, int, int, int, int, bool) (ffmpeg.cpp:480)
==796914== by 0x487F6E2: ncvisual_blit (visual.cpp:22)
==796914== by 0x4880068: ncvisual_render (visual.cpp:513)
==796914== by 0x4C86A9B: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:402)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Block was alloc'd at
==796914== at 0x483AEB8: memalign (vg_replace_malloc.c:906)
==796914== by 0x483AFCE: posix_memalign (vg_replace_malloc.c:1070)
==796914== by 0x6919B14: av_malloc (in /usr/lib/x86_64-linux-gnu/libavutil.so.56.51.100)
==796914== by 0x6919ECD: av_mallocz (in /usr/lib/x86_64-linux-gnu/libavutil.so.56.51.100)
==796914== by 0x6848FCF: ??? (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x684AAD3: sws_init_context (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x68A07F9: sws_getCachedContext (in /usr/lib/x86_64-linux-gnu/libswscale.so.5.7.100)
==796914== by 0x4C86DE9: ffmpeg_blit(ncvisual*, int, int, ncplane*, blitset const*, int, int, int, int, int, int, bool) (ffmpeg.cpp:480)
==796914== by 0x487F6E2: ncvisual_blit (visual.cpp:22)
==796914== by 0x4880068: ncvisual_render (visual.cpp:513)
==796914== by 0x4C86A9B: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:402)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
==796914== Invalid read of size 8
==796914== at 0x487AC70: channels_set_fg_alpha (notcurses.h:368)
==796914== by 0x487AC70: cell_set_fg_alpha (notcurses.h:702)
==796914== by 0x487AC70: init_rvec (render.c:362)
==796914== by 0x487AC70: engorge_crender_vector (render.c:1171)
==796914== by 0x487AC70: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb01a30 is 16 bytes after a block of size 371,520 alloc'd
==796914== at 0x483AD7B: realloc (vg_replace_malloc.c:834)
==796914== by 0x487AC2F: engorge_crender_vector (render.c:1165)
==796914== by 0x487AC2F: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
==796914== Invalid write of size 8
==796914== at 0x487ACA3: channels_set_bchannel (notcurses.h:282)
==796914== by 0x487ACA3: channels_set_bg_alpha (notcurses.h:430)
==796914== by 0x487ACA3: cell_set_bg_alpha (notcurses.h:707)
==796914== by 0x487ACA3: init_rvec (render.c:363)
==796914== by 0x487ACA3: engorge_crender_vector (render.c:1171)
==796914== by 0x487ACA3: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb01a30 is 16 bytes after a block of size 371,520 alloc'd
==796914== at 0x483AD7B: realloc (vg_replace_malloc.c:834)
==796914== by 0x487AC2F: engorge_crender_vector (render.c:1165)
==796914== by 0x487AC2F: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
==796914== Invalid read of size 1
==796914== at 0x4878B73: cell_wide_right_p (notcurses.h:719)
==796914== by 0x4878B73: paint (render.c:263)
==796914== by 0x487ACFE: ncpile_render_internal (render.c:1130)
==796914== by 0x487ACFE: ncpile_render (render.c:1188)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb01a2d is 13 bytes after a block of size 371,520 alloc'd
==796914== at 0x483AD7B: realloc (vg_replace_malloc.c:834)
==796914== by 0x487AC2F: engorge_crender_vector (render.c:1165)
==796914== by 0x487AC2F: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
==796914== Invalid read of size 8
==796914== at 0x4878B80: cell_bg_alpha (notcurses.h:1945)
==796914== by 0x4878B80: paint (render.c:271)
==796914== by 0x487ACFE: ncpile_render_internal (render.c:1130)
==796914== by 0x487ACFE: ncpile_render (render.c:1188)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914== Address 0x1fb01a30 is 16 bytes after a block of size 371,520 alloc'd
==796914== at 0x483AD7B: realloc (vg_replace_malloc.c:834)
==796914== by 0x487AC2F: engorge_crender_vector (render.c:1165)
==796914== by 0x487AC2F: ncpile_render (render.c:1184)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
==796914==
valgrind: m_mallocfree.c:303 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 371584, hi = 0.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata. If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away. Please try that before reporting this as a bug.
host stacktrace:
==796914== at 0x58047B6A: show_sched_status_wrk (m_libcassert.c:406)
==796914== by 0x58047C87: report_and_quit (m_libcassert.c:477)
==796914== by 0x58047E17: vgPlain_assert_fail (m_libcassert.c:543)
==796914== by 0x580522E4: get_bszB_as_is (m_mallocfree.c:303)
==796914== by 0x580522E4: is_inuse_block (m_mallocfree.c:331)
==796914== by 0x580522E4: vgPlain_describe_arena_addr (m_mallocfree.c:1592)
==796914== by 0x5803ECEA: vgPlain_describe_addr (m_addrinfo.c:185)
==796914== by 0x5803DB3F: vgMemCheck_update_Error_extra (mc_errors.c:1185)
==796914== by 0x58042BF4: vgPlain_maybe_record_error (m_errormgr.c:822)
==796914== by 0x5803CFA8: vgMemCheck_record_address_error (mc_errors.c:765)
==796914== by 0x58018504: mc_LOADVn_slow (mc_main.c:1557)
==796914== by 0x100469FF75: ???
==796914== by 0x1002EA9F2F: ???
==796914== by 0x1002EA9F17: ???
==796914== by 0x1002EA9F2F: ???
==796914== by 0x1002EA9F3F: ???
sched status:
running_tid=1
Thread 1: status = VgTs_Runnable (lwpid 796914)
==796914== at 0x487893A: channels_blend (internal.h:887)
==796914== by 0x4878BDF: cell_blend_bchannel (internal.h:916)
==796914== by 0x4878BDF: paint (render.c:281)
==796914== by 0x487ACFE: ncpile_render_internal (render.c:1130)
==796914== by 0x487ACFE: ncpile_render (render.c:1188)
==796914== by 0x487BCC0: notcurses_render (render.c:1198)
==796914== by 0x10C2C6: render (NotCurses.hh:195)
==796914== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==796914== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==796914== by 0x10BACF: stream (Visual.hh:76)
==796914== by 0x10BACF: main (play.cpp:311)
client stack range: [0x1FFEFE6000 0x1FFF000FFF] client SP: 0x1FFEFFF8D8
valgrind stack range: [0x1002DAA000 0x1002EA9FFF] top usage: 18472 of 1048576
Note: see also the FAQ in the source distribution.
I found this easiest to reproduce by right-clicking on the window titlebar, and selecting "resize", which lets one continuously resize until pressing enter or escape. Do it, and then just jam left and right a bunch.
I changed engorge_crender_vec()
to always realloc()
, and this made the problem go away (so far as I could tell), without any speed penalty. Unfortunately, it looks like musl always moves the argument to realloc()
with an unconditional alloc, alas (see https://github.com/esmil/musl/blob/master/src/malloc/malloc.c). so that's not going to fly on at least musl, meaning we must actually fix this properly. can we just cache crenderlen in ncpile
?
Alright, yeah, we just stash it now. I can't reproduce this at the moment, and this would seem to close all paths to this bug. But I still don't understand exactly what was happening... :/
nope! we now see
==1490971== Conditional jump or move depends on uninitialised value(s)
==1490971== at 0x487AC21: engorge_crender_vector (render.c:1163)
==1490971== by 0x487AC21: ncpile_render (render.c:1182)
==1490971== by 0x487BCC0: notcurses_render (render.c:1196)
==1490971== by 0x10C2C6: render (NotCurses.hh:195)
==1490971== by 0x10C2C6: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:110)
==1490971== by 0x4C86A11: ffmpeg_stream(notcurses*, ncvisual*, float, int (*)(ncvisual*, ncvisual_options*, timespec const*, void*), ncvisual_options const*, void*) (ffmpeg.cpp:428)
==1490971== by 0x10BACF: stream (Visual.hh:76)
==1490971== by 0x10BACF: main (play.cpp:311)
==1490971==
but only, i think, the first time. possibly not initializing pile->crender
?
yeah crenderlen
wasn't initialized, stupid.
...fixed? can't reproduce...let me make sure i can still reproduce with the old binary....
Yep, I was able to smack the old binary pretty easily. I guess that did fix it. How was the computation based on oldlen going wrong? Harumph.
==1497490== Invalid write of size 8
==1497490== at 0x483F6DB: memset (vg_replace_strmem.c:1251)
==1497490== by 0x48CC6FC: UnknownInlinedFun (string_fortified.h:71)
==1497490== by 0x48CC6FC: init_rvec (render.c:359)
==1497490== by 0x48CC6FC: engorge_crender_vector (render.c:1171)
==1497490== by 0x48CC6FC: ncpile_render (render.c:1184)
==1497490== by 0x48CD840: notcurses_render (render.c:1198)
==1497490== by 0x10C379: UnknownInlinedFun (NotCurses.hh:195)
==1497490== by 0x10C379: perframe(ncvisual*, ncvisual_options*, timespec const*, void*) (play.cpp:107)
==1497490== by 0x489B041: ncvisual_stream (ffmpeg.cpp:428)
==1497490== by 0x10BB2A: stream (Visual.hh:76)
==1497490== by 0x10BB2A: main (play.cpp:308)
==1497490== Address 0x10aaba10 is 0 bytes after a block of size 429,840 alloc'd
==1497490== at 0x483AD7B: realloc (vg_replace_malloc.c:834)
==1497490== by 0x48CC6DF: engorge_crender_vector (render.c:1165)
(2.1.7 binary)
I was playing around with
ncplayer
while working on #1298, and resized the terminal while I had an image open. The binary then aborted, looking an awful lot like a C++ exception. This doesn't happen all the time (and in fact I couldn't reproduce it over a half-dozen tries), but it definitely happened once, a solidSIGABRT
.