mike-mcgann commented on code in PR #974:
URL: https://github.com/apache/daffodil/pull/974#discussion_r1122095224


##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/BinaryNumberParsers.scala:
##########
@@ -167,6 +167,16 @@ abstract class BinaryIntegerBaseParser(
   def parse(start: PState): Unit = {
     val nBits = getBitLength(start)
     if (nBits == 0) return // zero length is used for outputValueCalc often.
+    if (primNumeric.width.isDefined) {
+      val width = primNumeric.width.get
+      if (nBits > width)
+        PE(
+          start,

Review Comment:
   I tried to test this by using an expression such as `{ 2 * 8 }` but I guess 
that expression could actually be evaluated at compile time and wasn't 
exercising the runtime check. I updated the test to get the value from the 
first byte in the data stream. 



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