{"record":{"id":"07e17d81f1ed2cfa","repo":"OpenRA/OpenRA","slug":"invalid-repeat-start-block-length-in-voc-file","errorCode":null,"errorMessage":"Invalid repeat start block length in voc file","messagePattern":"Invalid repeat start block length in voc file","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs","lineNumber":216,"sourceCode":"\t\t\t\t\t}\n\n\t\t\t\t\t// Silence\n\t\t\t\t\tcase 3:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (block.Length != 3)\n\t\t\t\t\t\t\tthrow new InvalidDataException(\"Invalid silence block length in voc file\");\n\t\t\t\t\t\tblock.SampleBlock.Offset = 0;\n\t\t\t\t\t\tblock.SampleBlock.Samples = stream.ReadUInt16() + 1;\n\t\t\t\t\t\tvar freqDiv = stream.ReadUInt8();\n\t\t\t\t\t\tblock.SampleBlock.Rate = GetSampleRateFromVocRate(freqDiv);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Repeat start\n\t\t\t\t\tcase 6:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (block.Length != 2)\n\t\t\t\t\t\t\tthrow new InvalidDataException(\"Invalid repeat start block length in voc file\");\n\t\t\t\t\t\tblock.LoopBlock.Count = stream.ReadUInt16() + 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Repeat end\n\t\t\t\t\tcase 7:\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t// Extra info\n\t\t\t\t\tcase 8:\n\t\t\t\t\t{\n\t\t\t\t\t\tif (block.Length != 4)\n\t\t\t\t\t\t\tthrow new InvalidDataException(\"Invalid info block length in voc file\");\n\t\t\t\t\t\tint freqDiv = stream.ReadUInt16();\n\t\t\t\t\t\tif (freqDiv == 65536)\n\t\t\t\t\t\t\tthrow new InvalidDataException(\"Invalid frequency divisor 65536 in voc file\");\n\t\t\t\t\t\tvar codec = stream.ReadUInt8();\n\t\t\t\t\t\tif (codec != 0)","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Cnc/AudioLoaders/VocLoader.cs#L198-L234","documentation":"Thrown when a Repeat start block (block code 6) does not have exactly 2 bytes of payload. The repeat-start marker must contain a single UInt16 specifying the loop count. A different length means the block is malformed.","triggerScenarios":"VocFormat.Preload, case 6: the check `block.Length != 2` fires when the 3-byte block length field is not 2.","commonSituations":"Corrupted or hand-edited VOC files with loop markers. VOC files from converters that emit non-standard repeat block sizes.","solutions":["Re-extract the asset from a trusted source.","Remove or fix loop markers using a VOC-aware audio editor.","If generating VOC files, ensure code-6 blocks always have Length set to 2."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { sound = new VocFormat(stream); }\ncatch (InvalidDataException) { /* file rejected */ }","preventionTips":["Ensure VOC files with loop markers use the standard 2-byte repeat-start block.","Re-extract from original game data if block structures are in doubt."],"tags":["audio","voc","file-format","corrupt-file","validation"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}