amitkumar3968 / openjpeg

Automatically exported from code.google.com/p/openjpeg
Other
0 stars 0 forks source link

MJ2: realloc is misused and may leak memory #168

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
One shall never write
   p = realloc(p, len);

but 
   p2 = realloc(p, len);
   if (!p2) { handle the error/free the memory/...}

Original issue reported on code.google.com by luc.herm...@gmail.com on 22 Aug 2012 at 6:41

GoogleCodeExporter commented 9 years ago
Most calls to realloc have been fixed in r1896.

Somebody should have a look at libopenjpeg/t2.c, I'm not sure whether bio shall 
be destroyed or left alone at 3 lines in t2_decode_packet().

Original comment by luc.herm...@gmail.com on 22 Aug 2012 at 6:47

GoogleCodeExporter commented 9 years ago
luc the code base changed quite a lot, I cannot find the realloc call you are 
talking about. I am closing the issue for now, please re-open if you can find 
it in current openjpeg codebase.

Original comment by mathieu.malaterre on 26 Feb 2014 at 4:23

GoogleCodeExporter commented 9 years ago
Indeed, I had a quick look to the current code base. I've just found a few 
remaining misuses in openmj2/j2k.c.

Original comment by luc.herm...@gmail.com on 27 Feb 2014 at 5:25

GoogleCodeExporter commented 9 years ago
could you provide a patch, and or outline the lines ?

Original comment by mathieu.malaterre on 7 Mar 2014 at 3:14