Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize the code in cmsFreeProfileSequenceDescription() #406

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

x2018
Copy link
Contributor

@x2018 x2018 commented Oct 26, 2023

Hi, when I test the release version 2.15, I got the error below:

==12022==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000028 (pc 0x0000006a3e15 bp 0x7ffff47d3380 sp 0x7ffff47d32c0 T0)
==12022==The signal is caused by a READ memory access.
==12022==Hint: address points to the zero page.
    #0 0x6a3e15 in cmsFreeProfileSequenceDescription Little-CMS-lcms2.15/src/cmsnamed.c:818:40
    #1 0x6a4d99 in cmsDupProfileSequenceDescription Little-CMS-lcms2.15/src/cmsnamed.c:864:5

Based on simple analysis, it is because pseq ->seq is not checked in cmsFreeProfileSequenceDescription() of version 2.15.
I found that the above problem is fixed in ac9e8e1, but the code could still be optimized:
if pseq ->seq is NULL, then it is unnecessary to enter the loop so that we just need to check the pointer one time.

@mm2 mm2 merged commit 5c0655a into mm2:master Oct 26, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants