We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3454

Summary: memory. double free or corrupted.
Product: SDL Reporter: Sakura <sakura.ix86>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sylvain.becker
Version: 2.0.4   
Hardware: x86_64   
OS: Linux   
Attachments: source code of my jpeg decoder with sdl2

Description Sakura 2016-10-14 20:28:02 UTC
Created attachment 2584 [details]
source code of my jpeg decoder with sdl2

If i include sdl into my jpeg decoder, some jpg's can not draw.

gcc *.c -lpthread -lm -I/usr/local/lib/ -lSDL2
./a.out 5in.jpg
Comment 1 Sylvain 2016-11-03 13:35:17 UTC
I think this can be closed ...

valgrind reports an issue in your code, when decoding the 5in.jpg:


malloc(3584) 0xa181c90
malloc(3584) 0xa182ae0
malloc(3584) 0xa183930
==14966== Invalid write of size 1
==14966==    at 0x109AE3: funcYCbCrToRGB (jpegStream.c:249)
==14966==    by 0x10AEDF: jsycbcrtorgb (jpegStream.c:664)
==14966==    by 0x10B6A0: main (main.c:110)
==14966==  Address 0xa182a9a is 0 bytes after a block of size 3,594 alloc'd
==14966==    at 0x4C2CB3F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==14966==    by 0x108E5C: my_malloc (common.c:13)
==14966==    by 0x10AE0D: jsycbcrtorgb (jpegStream.c:655)
==14966==    by 0x10B6A0: main (main.c:110)
Comment 2 Sam Lantinga 2016-11-03 22:58:44 UTC
Sylvain, thanks for investigating.

Sakura, please reopen this bug if your code runs cleanly under valgrind and you're still seeing this problem.