Skip to content

Conversation

@krystophny
Copy link
Collaborator

Summary

  • Adds comprehensive RGB value validation to pdf_write_color subroutine
  • Handles NaN, infinity, and out-of-range color values gracefully
  • Fixes critical crash in colored_contours example that was blocking GitHub Pages deployment

Changes

  • Added IEEE_ARITHMETIC intrinsic module for NaN/infinity detection
  • Implemented validation logic to check each RGB component
  • Clamps values to valid [0.0, 1.0] range
  • Defaults invalid values to black (0.0) for safety

Testing

  • ✅ colored_contours example now runs successfully
  • ✅ All 5 PDF files generated correctly with valid content
  • ✅ All existing tests continue to pass
  • ✅ No regressions introduced

Impact

This fix restores the GitHub Pages visual showcase functionality by allowing the colored_contours example to complete successfully. The validation ensures robust handling of edge cases in color mapping algorithms.

Fixes #317

Add comprehensive validation to pdf_write_color subroutine to handle
invalid RGB values (NaN, infinity, out-of-range) gracefully. This
prevents 'End of record' crashes when color mapping produces invalid
values in contour plots.

- Use IEEE_ARITHMETIC intrinsic for NaN/infinity detection
- Clamp RGB values to valid [0.0, 1.0] range
- Default invalid values to black (0.0) for safety
- Fixes colored_contours example crash blocking GitHub Pages

Fixes #317
@codecov
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/fortplot_pdf_drawing.f90 0.00% 10 Missing ⚠️

📢 Thoughts on this report? Let us know!

@krystophny krystophny merged commit b76c03f into main Aug 25, 2025
5 checks passed
@krystophny krystophny deleted the fix-colored-contours-pdf-crash-317 branch August 25, 2025 09:30
krystophny added a commit that referenced this pull request Aug 25, 2025
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.

fix: colored_contours PDF runtime crash - End of record error in pdf_write_color

2 participants