Bug 691267 - jbig2dec needs to check malloc() return values
Summary: jbig2dec needs to check malloc() return values
Status: RESOLVED FIXED
Alias: None
Product: jbig2dec
Classification: Unclassified
Component: Parsing (show other bugs)
Version: master
Hardware: All All
: P4 enhancement
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-27 07:53 UTC by Masaki Ushizaka
Modified: 2012-02-08 16:49 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
check all malloc paths for an error being returned (74.63 KB, patch)
2011-11-27 15:39 UTC, Shailesh Mistry
Details | Diff
Patch to check for realloc error paths (4.40 KB, patch)
2011-12-16 18:54 UTC, Shailesh Mistry
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Masaki Ushizaka 2010-04-27 07:53:49 UTC
There are some codes that doesn't check return values from jbig2_alloc() in the jbig2dec library.
Those should be modified to return appropriate errors.
Comment 1 Shailesh Mistry 2011-11-27 15:39:29 UTC
Created attachment 8160 [details]
check all malloc paths for an error being returned

This patch checks all return paths to ensure that the appropriate error is returned on failure. It has been regression tested and no cluster differences were found.
Comment 2 Henry Stiles 2011-11-28 22:31:37 UTC
Okay Shailesh, please commit.
Comment 3 Shailesh Mistry 2011-11-29 20:40:54 UTC
Patch committed in d20a6cb9f12682804af2e74ec5d6bb75ca9d5410
Comment 4 Shailesh Mistry 2011-12-16 18:54:56 UTC
Created attachment 8227 [details]
Patch to check for realloc error paths

This patch adds to the previous one by catering for the following areas :-

1) All realloc paths have been checked to ensure the correct error is returned on failure

2) code now redundant due to the use of memset has been removed

3) free memory highlighted by valgrind run
Comment 5 Henry Stiles 2012-01-10 16:01:07 UTC
Thanks Shailesh, please commit.
Comment 6 Shailesh Mistry 2012-01-20 21:44:05 UTC
Patch committed in c0573245db4f03c6cdca24906d73151a4e9be3c9