Adds Duration Extension and Offset Function support#331
Conversation
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
CedarJava/src/main/java/com/cedarpolicy/serializer/ValueDeserializer.java
Outdated
Show resolved
Hide resolved
CedarJava/src/main/java/com/cedarpolicy/serializer/ValueDeserializer.java
Show resolved
Hide resolved
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
| if (isNegative) { | ||
| totalMs = Math.negateExact(totalMs); | ||
| } |
There was a problem hiding this comment.
The code before this is going to overflow before negating the i64::MIN value. In other words, this code should be able to parse duration("-9223372036854775808ms") but it doesn't currently because it'll overflow before getting here.
There was a problem hiding this comment.
Nice catch. I'll update it and also add the test cases from lean
There was a problem hiding this comment.
Resolved in the revision
| "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.)" | ||
| + "{3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); | ||
| + "{3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | ||
| + "(?:/(?:[0-9]|[12][0-9]|3[0-2]))?$"); |
There was a problem hiding this comment.
Does this mean you couldn't accept ranges before?
There was a problem hiding this comment.
Apparently yes. We just caught it due to the updated corpus tests
There was a problem hiding this comment.
In that case, this fix probably deserves its own PR. You could probably ship it faster that way, and also include unit tests to make sure we've actually fixed this case. Not a blocker for this PR though.
There was a problem hiding this comment.
I'll add a couple of tests in a subsequent PR
…ases Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Overview
Changes
com.cedarpolicy.value.Durationcom.cedarpolicy.value.functions.Offsetequalsorhashas this is supposed to represent a functioncom.cedarpolicy.value.Decimalcom.cedarpolicy.value.IpAddressExample Usage
Duration
Offset