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

fix potential overflow that can lead to infinite loop in file reading #6

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

hellkite500
Copy link
Member

@hellkite500 hellkite500 commented Apr 24, 2023

A potential overflow bug exists in the read_file_line_counts function. Depending on system, compiler, and hardware, this can lead to a infinite loop.

Changes

  • Change the i/o buffer type for character reading to int from char to avoid overflowing a possible unsigned char type.

Testing

  1. Tested through ngen unit tests

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Target Environment support

  • Linux (x86 and arm)
  • MacOS (x86 and arm)

@hellkite500 hellkite500 added the bug Something isn't working label Apr 24, 2023
@SnowHydrology SnowHydrology merged commit 4cec8b3 into NOAA-OWP:master Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants