{"record":{"id":"b04ef70248db7b66","repo":"NationalSecurityAgency/ghidra","slug":"invalid-max-max","errorCode":null,"errorMessage":"Invalid max: {max}","messagePattern":"Invalid max: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/FieldSpan.java","lineNumber":120,"sourceCode":"\t\t\t\t? DOMAIN.closed(End.lower(from, fromInclusive), End.positiveInfinity())\n\t\t\t\t: DOMAIN.closed(End.negativeInfinity(), End.upper(from, fromInclusive));\n\t}\n\n\t/**\n\t * The domain of field values, allowing open endpoints\n\t */\n\tpublic class Domain extends EndDomain<Field, FieldSpan> {\n\t\tprivate Domain() {\n\t\t\tsuper(Field::compareTo);\n\t\t}\n\n\t\t@Override\n\t\tpublic FieldSpan closed(End<Field> min, End<Field> max) {\n\t\t\tif (!min.isValidMin()) {\n\t\t\t\tthrow new IllegalArgumentException(\"Invalid min: \" + min);\n\t\t\t}\n\t\t\tif (!max.isValidMax()) {\n\t\t\t\tthrow new IllegalArgumentException(\"Invalid max: \" + max);\n\t\t\t}\n\t\t\treturn super.closed(min, max);\n\t\t}\n\n\t\t@Override\n\t\tpublic FieldSpan newSpan(End<Field> min, End<Field> max) {\n\t\t\treturn new Impl(min, max);\n\t\t}\n\n\t\t@Override\n\t\tpublic FieldSpan empty() {\n\t\t\treturn EMPTY;\n\t\t}\n\n\t\t@Override\n\t\tpublic FieldSpan all() {\n\t\t\treturn ALL;\n\t\t}","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/FieldSpan.java#L102-L138","documentation":"Symmetric to the min case: NEG_INF returns isValidMax()==false because nothing can be less-than-or-equal to -inf as an upper bound, so closed(..., NEG_INF) is impossible and IllegalArgumentException is thrown.","triggerScenarios":"A max endpoint whose isValidMax() is false - the builtin case is NEG_INF used as the upper bound.","commonSituations":"Inverted bounds leaking negative infinity into the max slot; generic range builders that don't validate endpoints; min/max swapped during construction.","solutions":["Use a finite End or POS_INF for the max endpoint.","Validate isValidMax() before calling closed() in generic code.","Ensure bounds are ordered min <= max before construction."],"exampleFix":"// before\nspan = domain.closed(someMin, End.NEG_INF);\n// after\nspan = domain.closed(someMin, aFiniteOrPosInfMax);","handlingStrategy":"validation","validationCode":"if (!max.isValidMax()) {\n    // swap in a finite or POS_INF max before constructing the span\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate endpoints before closed() in generic range code.","Never use NEG_INF as a maximum endpoint."],"tags":["range","validation","data-structure"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}