Skip to content

refactor: apply consistent validation pattern to other PDF write functions #321

@krystophny

Description

@krystophny

The validation pattern added to pdf_write_color in #318 could be beneficial for other PDF writing functions to prevent similar format-related crashes.

Functions to Review

  • pdf_write_move(x, y) - validate x, y coordinates
  • pdf_write_line(x, y) - validate x, y coordinates
  • pdf_write_line_width(width) - validate width > 0
  • Other format-based write operations

Implementation

  • Apply similar NaN/infinity checks where appropriate
  • Ensure consistent error handling across all PDF write operations
  • Add unit tests for edge cases

Benefits

  • Prevent similar 'End of record' crashes
  • Consistent defensive programming at I/O boundaries
  • More robust PDF generation overall

This is a non-critical code quality improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions