Skip to content

Commit

Permalink
guard against Int64 max
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Nov 22, 2024
1 parent ceb373a commit 6c89ebf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/AwsCommonRuntimeKit/crt/CBOR.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ public class CBORDecoder {
else {
throw CommonRunTimeError.crtError(.makeFromLastError())
}
guard out_value <= Int64.max else {
throw CommonRunTimeError.crtError(CRTError(code: AWS_ERROR_CBOR_UNEXPECTED_TYPE.rawValue))
}
return .int(Int64(-Int64(out_value) - 1))
}
case AWS_CBOR_TYPE_FLOAT:
Expand Down

0 comments on commit 6c89ebf

Please sign in to comment.