Range check mask_table entries before writing maskmap - #1920
Open
arpitjain099 wants to merge 1 commit into
Open
arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
parse_mask_table validates nmask, the layout against size(maskmap), ntiles, npes and the record count, and then writes maskmap at the row and column the file supplies without checking either. An entry outside the layout gives a bounds error in a checked build and a silent write past the array otherwise. Both the 2d and 3d variants have it. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
arpitjain099
requested review from
bensonr,
rem1776,
uramirez8707 and
vithikashah001
as code owners
September 21, 2026 15:58
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
parse_mask_table_2dchecks quite a lot before it uses the file:nmaskagainst the record count, the layout againstsize(maskmap),ntiles,npes. Then it writes at whatever indices the records carried:Running that loop with the shapes a 2 by 3 layout gives, and an entry of
9,9:The second line is the one that matters: production builds do not carry
-fcheck, so a mask table with a typo writes a.false.somewhere outside the array and the run continues.The check compares each index against
size(maskmap, ...)and raises the samempp_error(FATAL, ...)the routine already uses for the other malformed cases.parse_mask_table_3dhas the same loop and gets the same treatment.I could not build FMS here, it needs MPI and netCDF, so the runs above are that loop with the same array shapes rather than the library.