Skip to content

Commit b4f59ba

Browse files
author
Janusz Majnert
committed
APER - Check that calculated rawLength is not zero
1 parent 91811b3 commit b4f59ba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/asn1/aper/aper.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,10 @@ func (pd *perBitData) parseInteger(extensed bool, lowerBoundPtr *int64, upperBou
578578
rawLength = uint(pd.bytes[pd.byteOffset])
579579
pd.byteOffset++
580580
log.Debugf("%s", perBitLog(8, pd.byteOffset, pd.bitsOffset, uint64(rawLength)))
581+
if rawLength == 0 {
582+
err := fmt.Errorf("rawLength cannot be 0")
583+
return int64(0), err
584+
}
581585
} else if valueRange <= 65536 {
582586
rawValue, err := pd.parseConstraintValue(valueRange)
583587
if err != nil {

0 commit comments

Comments
 (0)