{"record":{"id":"b8ac20051516912e","repo":"aeron-io/aeron","slug":"invalid-value-length","errorCode":null,"errorMessage":"Invalid value length","messagePattern":"Invalid value length","errorType":"validation","errorClass":"InvalidMessage","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/logging/CborDecode.java","lineNumber":307,"sourceCode":"            state.ensureRemaining(2);\n            value = 0xFFFF & state.buffer().getShort(state.offset(), BIG_ENDIAN);\n            state.incrementOffset(2);\n        }\n        else if (ADDITIONAL_CONTENT_4_BYTE == valueAdditionalContent)\n        {\n            state.ensureRemaining(4);\n            value = 0xFFFFFFFFL & state.buffer().getInt(state.offset(), BIG_ENDIAN);\n            state.incrementOffset(4);\n        }\n        else if (ADDITIONAL_CONTENT_8_BYTE == valueAdditionalContent)\n        {\n            state.ensureRemaining(8);\n            value = state.buffer().getLong(state.offset(), BIG_ENDIAN);\n            state.incrementOffset(8);\n        }\n        else\n        {\n            throw new InvalidMessage(\"Invalid value length\");\n        }\n\n        if (NEGATIVE_INTEGER_MAJOR_TYPE == valueMajorType)\n        {\n            value = ~value;\n        }\n\n        return value;\n    }\n\n    private void parseByteArray(\n        final DecodingState state,\n        final DirectBuffer targetBuffer,\n        final int keyAdditionalContent)\n    {\n        if (keyAdditionalContent < ADDITIONAL_CONTENT_1_BYTE)\n        {\n            targetBuffer.wrap(state.buffer(), state.offset(), keyAdditionalContent);","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/logging/CborDecode.java#L289-L325","documentation":"parseNumber in CborDecode requires the CBOR additional-info bits to encode either an inline value or 1, 2, 4, or 8 following bytes. Any other additional-content value (the reserved/invalid lengths like 7 for integer major types, or >7 non-standard) hits the else branch and throws. The number is otherwise read big-endian and negated for negative-integer major type.","triggerScenarios":"CBOR integer whose additional-info byte is not 0-7-compatible with the supported widths — e.g. value 7 (float/simple encoding) on a 0/1 major type, or a corrupt length byte in the log buffer.","commonSituations":"Decoding logs produced by non-standard CBOR encoders; corrupted capture buffers; hand-crafted CBOR in tests; decoder pointed at wrong offset so a float header is read as an integer.","solutions":["Ensure the CBOR payload encodes integers with additional-info 24/25/26/27 (1/2/4/8 bytes) or inline (<24).","Re-capture the event log with matching encoder/decoder versions.","Validate the buffer offset alignment before parseNumber runs.","Patch parseNumber to accept additional encodings if your encoder emits them."],"exampleFix":"// before\nelse\n{\n    throw new InvalidMessage(\"Invalid value length\");\n}\n// after\nelse\n{\n    throw new InvalidMessage(\"Invalid CBOR integer additional-info value=\" + valueAdditionalContent);\n}","handlingStrategy":"try-catch","validationCode":"// verify additional-info bits of the number header are a supported width\nfinal int extraInfo = buffer.getByte(offset) & 0b000_11111;\nif (extraInfo > 27 || (extraInfo >= 7 && extraInfo <= 23)) { /* unsupported width */ }","typeGuard":"boolean isSupportedCborIntegerEncoding(final byte headerByte)\n{\n    final int info = headerByte & 0b000_11111;\n    return info < 24 || info == 24 || info == 25 || info == 26 || info == 27;\n}","tryCatchPattern":"try\n{\n    value = CborDecode.parseLong(state);\n}\ncatch (final InvalidMessage ex)\n{\n    LOGGER.warn(\"bad integer encoding at offset \" + state.offset());\n    return false;\n}","preventionTips":["Encode integers with standard CBOR width prefixes (24-27).","Match encoder/decoder versions.","Start decode at the exact record boundary.","Catch InvalidMessage per record so parsing continues."],"tags":["cbor","decoding","serialization"],"backgroundTag":"invalid-argument-format","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}