{"record":{"id":"5ebecc9f6830cd54","repo":"oven-sh/bun","slug":"badalignment","errorCode":null,"errorMessage":"BadAlignment","messagePattern":"BadAlignment","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/exe_format/pe.rs","lineNumber":13,"sourceCode":"// Windows PE sections use standard file alignment (typically 512 bytes)\n// No special 16KB alignment needed like macOS code signing\n\nuse core::mem::{offset_of, size_of};\nuse core::ptr;\nuse core::slice;\n\n// New error types for PE manipulation\n#[derive(thiserror::Error, strum::IntoStaticStr, Debug, Copy, Clone, Eq, PartialEq)]\npub enum Error {\n    #[error(\"OutOfBounds\")]\n    OutOfBounds,\n    #[error(\"BadAlignment\")]\n    BadAlignment,\n    #[error(\"Overflow\")]\n    Overflow,\n    #[error(\"InvalidPEFile\")]\n    InvalidPEFile,\n    #[error(\"InvalidDOSSignature\")]\n    InvalidDOSSignature,\n    #[error(\"InvalidPESignature\")]\n    InvalidPESignature,\n    #[error(\"UnsupportedPEFormat\")]\n    UnsupportedPEFormat,\n    #[error(\"InsufficientHeaderSpace\")]\n    InsufficientHeaderSpace,\n    #[error(\"TooManySections\")]\n    TooManySections,\n    #[error(\"SectionExists\")]\n    SectionExists,\n    #[error(\"InputIsSigned\")]","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/exe_format/pe.rs#L1-L31","documentation":"PE error variant: a computed layout does not satisfy the alignment invariants Windows PE requires (file alignment typically 512 bytes, section alignment rules). The writer refuses to emit misaligned offsets because the resulting image would not load.","triggerScenarios":"Thrown at src/exe_format/pe.rs:13 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the target was linked with standard /FILEALIGN and /SECTIONALIGN settings","Fix the alignment computation (align_up usage) in pe.rs for the field being written"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","contentChangedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}