sahvx655-wq opened a new pull request, #426:
URL: https://github.com/apache/commons-validator/pull/426

   Noticed while exercising the check digit routines directly rather than 
through their wrapper validators.
   
   1. `ISSNCheckDigit.ISSN_CHECK_DIGIT.isValid` is a public entry point and 
`ModulusCheckDigit` never checks the code length, so an over-length string 
reaches the modulus test unchecked.
   2. `weightedValue` weights each position by `9 - leftPos`, so a ninth 
character lands on weight zero and contributes nothing; appending any character 
to a valid numeric ISSN (`031784710`..`031784719`, `0317847100`) still returns 
true, though only the eight-character `03178471` is a real ISSN.
   3. Guarded `isValid` to require the fixed eight-character length before the 
check digit test, the same shape as the existing `IBANCheckDigit` length guard; 
the `ISSNValidator`/`CodeValidator` path already enforces length, so valid 
input is unaffected.
   
   Regression test `testOverLengthRejected` added, which fails on the current 
code and passes with the guard.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to