Charge each listed TLV occurrence against the reassembly cap, and file the unknown-tag gap
Mirror / push (push) Has been cancelled
Test / lint (pull_request) Successful in 28s
Test / test (18) (pull_request) Successful in 36s
Test / test (20) (pull_request) Successful in 30s
Test / test (22) (pull_request) Successful in 30s
Test / test (24) (pull_request) Successful in 34s
Test / test (26) (pull_request) Successful in 35s
Mirror / push (push) Has been cancelled
Test / lint (pull_request) Successful in 28s
Test / test (18) (pull_request) Successful in 36s
Test / test (20) (pull_request) Successful in 30s
Test / test (22) (pull_request) Successful in 30s
Test / test (24) (pull_request) Successful in 34s
Test / test (26) (pull_request) Successful in 35s
This commit is contained in:
+6
-1
@@ -73,6 +73,9 @@ function detach(pduObj: PduObject): PduObject {
|
||||
return { ...pduObj, params, shortMessageOctets: octets, tlvs };
|
||||
}
|
||||
|
||||
// Roughly the heap a listed occurrence costs beyond its value, so a PDU of empty repeats is not free.
|
||||
const listedTlvOverhead = 200;
|
||||
|
||||
// A cstring param arrives as a string, and source_addr alone can carry most of a 1 MiB PDU.
|
||||
function sizeOf(value: ParamValue): number {
|
||||
if (Buffer.isBuffer(value)) return value.length;
|
||||
@@ -88,7 +91,9 @@ function octetsOf(pduObj: PduObject): number {
|
||||
}
|
||||
|
||||
for (const tlv of Object.values(pduObj.tlvs)) {
|
||||
octets += tlvOctets(tlv.tagValue);
|
||||
const listed = Array.isArray(tlv.tagValue) ? tlv.tagValue.length : 0;
|
||||
|
||||
octets += tlvOctets(tlv.tagValue) + listed * listedTlvOverhead;
|
||||
}
|
||||
|
||||
return octets;
|
||||
|
||||
Reference in New Issue
Block a user