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

Unreachable code in thumbhash_encoder_create function #129

Open
skidder opened this issue Aug 10, 2023 · 0 comments
Open

Unreachable code in thumbhash_encoder_create function #129

skidder opened this issue Aug 10, 2023 · 0 comments

Comments

@skidder
Copy link
Contributor

skidder commented Aug 10, 2023

The thumbhash_encoder_create function includes a null-check on the return value from new; however, if new were to fail, the default behavior is to throw an std::bad_alloc exception rather than return null, making the if-condition unreachable.

lilliput/thumbhash.cpp

Lines 18 to 21 in 217a9d5

thumbhash_encoder e = new struct thumbhash_encoder_struct();
if (!e) {
return NULL;
}

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 a pull request may close this issue.

1 participant