diff --git a/CHANGELOG.md b/CHANGELOG.md index 31cc83ffb..609e83f81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +* Fix crash when parsing FITS header long value ([#1366](https://github.com/CARTAvis/carta-backend/issues/1366)). + ### Changed * Move the loader cache to separate files ([#1021](https://github.com/CARTAvis/carta-backend/issues/1021)). * Improve the code style in HTTP server ([#1260](https://github.com/CARTAvis/carta-backend/issues/1260)). diff --git a/src/ImageData/CompressedFits.cc b/src/ImageData/CompressedFits.cc index 49ffa2e33..7e9c9dda5 100644 --- a/src/ImageData/CompressedFits.cc +++ b/src/ImageData/CompressedFits.cc @@ -414,6 +414,10 @@ void CompressedFits::AddHeaderEntry( } catch (std::invalid_argument) { // Set string value only entry->set_entry_type(CARTA::EntryType::STRING); + } catch (std::out_of_range) { + long lvalue = std::stol(value); + entry->set_numeric_value(lvalue); + entry->set_entry_type(CARTA::EntryType::INT); } } }