{"record":{"id":"4d0a7eadd4288e36","repo":"Pumpkin-MC/Pumpkin","slug":"resource-pack-status-is-too-large","errorCode":null,"errorMessage":"resource pack status is too large","messagePattern":"resource pack status is too large","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/pumpkin-protocol/src/bedrock/server/resource_pack_client_response.rs","lineNumber":20,"sourceCode":"\nuse crate::{codec::var_uint::VarUInt, serial::PacketRead};\nuse pumpkin_macros::packet;\n\n#[packet(8)]\npub struct SResourcePackClientResponse {\n    pub response: u8,\n    pub download_size: u16,\n    pub pack_ids: Vec<String>,\n}\n\nimpl PacketRead for SResourcePackClientResponse {\n    fn read<R: Read>(reader: &mut R) -> Result<Self, Error> {\n        let encoded_status = VarUInt::read(reader)?.0;\n        let response = encoded_status\n            .checked_add(1)\n            .and_then(|v| u8::try_from(v).ok())\n            .ok_or_else(|| {\n                Error::new(ErrorKind::InvalidData, \"resource pack status is too large\")\n            })?;\n        let _status_name = String::read(reader)?;\n\n        let pack_ids = if response == Self::STATUS_SEND_PACKS {\n            let count = VarUInt::read(reader)?.0;\n            if count > 1024 {\n                return Err(Error::new(\n                    ErrorKind::InvalidData,\n                    \"too many resource pack identifiers\",\n                ));\n            }\n            (0..count)\n                .map(|_| String::read(reader))\n                .collect::<Result<Vec<_>, _>>()?\n        } else {\n            Vec::new()\n        };\n        let download_size = u16::try_from(pack_ids.len()).map_err(|_| {","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-protocol/src/bedrock/server/resource_pack_client_response.rs#L2-L38","documentation":"Thrown when decoding the Bedrock ResourcePackClientResponse packet: the VarUInt-encoded status, incremented by one to map onto the u8 status constants, overflows u8 or exceeds it. Any encoded_status >= 255 is invalid and signals a malformed packet.","triggerScenarios":"ResourcePackClientResponse where the status VarUInt is >= 255 so checked_add(1) + u8::try_from fails.","commonSituations":"Protocol version mismatch causing the status field to be misread, corrupted network data, or crafted packets probing the pack-response handler.","solutions":["Confirm client and server agree on the Bedrock protocol version","Capture and inspect raw bytes of the offending packet","Update the protocol crate if the client uses a newer status encoding","Disconnect clients sending invalid status values"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let encoded = VarUInt::read(r)?.0;\nlet ok = encoded.checked_add(1).and_then(|v| u8::try_from(v).ok()).is_some();\nif !ok { return Err(...); }","typeGuard":null,"tryCatchPattern":"match ResourcePackClientResponse::read(reader) {\n    Ok(resp) => handle(resp),\n    Err(e) if e.kind() == std::io::ErrorKind::InvalidData => disconnect(peer, \"invalid pack status\"),\n    Err(e) => Err(e.into()),\n}","preventionTips":["Never widen status parsing without rechecking the u8 constants table","Validate status enums with checked arithmetic/try_from","Keep protocol version negotiation strict","Log the raw status value before erroring to ease diagnosis"],"tags":["bedrock","protocol","packet-decoding","overflow"],"backgroundTag":"value-out-of-range","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}