mbeckerle commented on a change in pull request #433:
URL: https://github.com/apache/incubator-daffodil/pull/433#discussion_r504227875



##########
File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/HexBinaryLengthParsers.scala
##########
@@ -36,6 +36,9 @@ sealed abstract class HexBinaryLengthParser(override val 
context: ElementRuntime
     val nBits = getLengthInBits(start).toInt
     if (nBits == 0) {
       currentElement.setDataValue(zeroLengthArray)
+    } else if (nBits < 0) {
+      // Integer overflow occurred, recommend using blob instead of hexBinary

Review comment:
       We're depending on 32-bit integer overflow? That's very unreliable. We 
should do math on Long type, and check the bound, and explicitly return -1 to 
indicate too big. 
   
   Or, if we are doing this right and signaling the overflow of the max length 
by -1 then the comment should change.
   




----------------------------------------------------------------
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.

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


Reply via email to