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

DM-35457: Fix handling of FITS error messages passed to C++ exceptions #647

Merged
merged 1 commit into from Jul 30, 2022

Conversation

mwittgen
Copy link
Contributor

No description provided.

src/fits.cc Outdated
cfitsioMsg[FLEN_ERRMSG-1] = char(0); // ensure termination
std::size_t len=strlen(cfitsioMsg);
for(std::size_t i=0;i<len;i++)
if(cfitsioMsg[i] < char(32)) cfitsioMsg[i] = '.';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I think my previous comment got rebased out).

I think isprint() as the test would be more explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ignore the previous version. isprint is clearly better.

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm astonished that a control character in an error message can mess up python's exception handling but this fix seems fine.

python/lsst/afw/fits/_fits.cc Show resolved Hide resolved
python/lsst/afw/fits/_fits.cc Show resolved Hide resolved
@mwittgen mwittgen merged commit d599963 into main Jul 30, 2022
@mwittgen mwittgen deleted the tickets/DM-35457 branch July 30, 2022 00:43
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.

None yet

2 participants