Skip to content
  • Alexandre Janniaux's avatar
    misc: image: refactor and fix ImageWrite · 2ea2c7eb
    Alexandre Janniaux authored and Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf committed
    Refactor code to always call the encoder at the end and separate the
    filtering case.
    
    Fix a crash (double-free) when the image handler needs to resize the
    picture before encoding it.
    
        ==150429==ERROR: AddressSanitizer: heap-use-after-free on address 0x614000002bb8 at pc 0x7f4ce1a8a092 bp 0x7fff205294c0 sp 0x7fff205294b0
        WRITE of size 8 at 0x614000002bb8 thread T0
            #0 0x7f4ce1a8a091 in vlc_atomic_rc_dec ../../include/vlc_atomic.h:66
            #1 0x7f4ce1a8a091 in picture_Release ../../include/vlc_picture.h:372
            #2 0x7f4ce1a8a091 in ImageWrite ../../src/misc/image.c:454
            #3 0x564f4f6a00f7 in OpenIntf ../../test/src/misc/image.c:52
            #4 0x7f4ce177bfee in generic_start ../../src/modules/modules.c:275
            #5 0x7f4ce177db75 in vlc_module_load ../../src/modules/modules.c:243
            #6 0x7f4ce177df33 in module_need ../../src/modules/modules.c:286
            #7 0x7f4ce179cbdd in intf_Create ../../src/interface/interface.c:172
            #8 0x7f4ce179d86a in libvlc_InternalAddIntf ../../src/interface/interface.c:267
            #9 0x7f4ce2350b22 in libvlc_add_intf ../../lib/playlist.c:41
            #10 0x564f4f69f53c in main ../../test/src/misc/image.c:122
    2ea2c7eb