{"record":{"id":"e67d927b69db338f","repo":"windmill-labs/windmill","slug":"aborted-from-c-e67d92","errorCode":null,"errorMessage":"Aborted from C","messagePattern":"Aborted from C","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"backend/parsers/windmill-parser-java/src/wasm_libc.rs","lineNumber":15,"sourceCode":"use std::collections::BTreeMap;\nuse std::sync::{Mutex, OnceLock};\nuse std::{\n    alloc::{self, Layout},\n    ffi::{c_char, c_int, c_void},\n    mem::align_of,\n    ptr,\n};\nuse wasm_bindgen::prelude::*;\n\n/* -------------------------------- stdlib.h -------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn abort() {\n    panic!(\"Aborted from C\");\n}\n\nmacro_rules! console_log {\n    ($($t:tt)*) => (unsafe { log(&format_args!($($t)*).to_string()) })\n}\n\n#[wasm_bindgen]\nextern \"C\" {\n    #[wasm_bindgen(js_namespace = console)]\n    fn log(a: &str);\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn malloc(size: usize) -> *mut c_void {\n    if size == 0 {\n        return ptr::null_mut();\n    }\n","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-java/src/wasm_libc.rs#L1-L33","documentation":"The Java-to-WASM parser's bundled libc shim defines `abort()` as a `#[no_mangle] extern \"C\"` stub that immediately panics. It exists only so C-compiled code linking against libc has a symbol for `abort`; the library does not implement (or allow) actual program abortion at runtime. When any code compiled into the WASM module calls `abort()`, the Rust panic unwinds into a `wasm-bindgen`/unreachable trap surfaced as \"Aborted from C\".","triggerScenarios":"Any C (or C-compatible Java-native) code path compiled into the parser's WASM module invokes the C standard library `abort()` — typically after an assertion failure, failed memory allocation, or an internal unreachable branch in the transpiled native code.","commonSituations":"Parsing a Java source file (or a jar/dependency tree) that drives the embedded C/LLVM-compiled component into an assertion or allocation-failure path; running the WASM parser on input it was never designed to handle; corrupted or truncated class files causing defensive abort() calls in native code.","solutions":["Identify which parsed input triggers the abort and minimize it to a small reproducer; it indicates the native component hit an unsupported/invalid state.","Check whether the Java parser version supports the construct/file being parsed and upgrade windmill-parser-java to the latest version.","Validate/sanitize the input before invoking the parser (e.g. confirm it is a well-formed .java/.class artifact).","If reproducible on valid input, file a bug against windmill-parser-java with the reproducer — abort() here is a hard stop with no recovery inside the module."],"exampleFix":"// before: feeding a truncated/corrupted class file straight to the parser\nparse(javaBytes);\n\n// after: verify the artifact before parsing\nif (!looksLikeValidJavaArtifact(javaBytes)) {\n    throw new IllegalArgumentException(\"input is not a well-formed Java artifact\");\n}\nparse(javaBytes);","handlingStrategy":"try-catch","validationCode":"if (!input || input.length === 0) throw new Error('empty parser input');\nif (!isWellFormedJavaArtifact(input)) throw new Error('input is not a well-formed Java artifact');","typeGuard":"function isWellFormedJavaArtifact(b) {\n  return typeof b === 'string' || (b instanceof Uint8Array && b.length > 0);\n}","tryCatchPattern":"try {\n  const result = parse(javaInput);\n} catch (e) {\n  if (String(e).includes('Aborted from C')) {\n    // WASM module aborted; treat input as unsupported and fail fast\n    throw new ParserUnsupportedInputError(javaInput);\n  }\n  throw e;\n}","preventionTips":["Validate Java artifacts (well-formed source/class files) before invoking the parser.","Pin and regularly bump windmill-parser-java to pick up parser fixes.","Keep a corpus minimizer handy to shrink inputs that abort the module.","Treat any WASM abort as unrecoverable: rethrow with input context rather than retrying."],"tags":["wasm","libc","panic","abort","java-parser"],"backgroundTag":"wasm-libc-stub-abort","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}