SwiftCBOR icon indicating copy to clipboard operation
SwiftCBOR copied to clipboard

UnkeyedDecodingContainer - corrupted data causes crash

Open skyfoxa opened this issue 3 years ago • 1 comments

Could we add a guard check before we touch data array with start and end indexes? We should throw an error if data doesn't contain requested range. It causes fatal error if data array doesn't contain range.startIndex..<(range.endIndex)

let container = _CBORDecoder.SingleValueContainer(data: self.data[range.startIndex..<(range.endIndex)], codingPath: self.codingPath, userInfo: self.userInfo)

skyfoxa avatar Oct 11 '21 12:10 skyfoxa

A PR for this would be great - are you able to give it a go? Then I can review and we can get something merged

hamchapman avatar Mar 10 '22 13:03 hamchapman