NationalSecurityAgency/ghidra · warning
exiting, no ASCII hex found\n
Error message
exiting, no ASCII hex found\n
What it means
gdis stdin-mode end-of-input message. In stdin_mode the program reads an address line then a bytes/options line via fgets; when the second fgets returns NULL (EOF / empty input) it prints 'exiting, no ASCII hex found' and returns 0 to finish the loop. This is a normal termination path, not a crash, though the wording reads like an error.
Source
Thrown at GPL/GnuDisassembler/src/gdis/c/disasm_1.c:360
strncpy(byteStringBuffer,bytesAndOptionsBuffer,(int) (p - bytesAndOptionsBuffer));
strncpy(disassemblerOptions,p+1,sizeof(disassemblerOptions));
p = strchr(disassemblerOptions,'\n');
if (p){
*p = '\0';
}
}
else {
//no "*" in the string, so no disassembly options
//replace newline with null terminator
strncpy(byteStringBuffer, bytesAndOptionsBuffer, sizeof(byteStringBuffer));
p = strchr(byteStringBuffer,'\n');
if (p){
*p = '\0';
}
}
}
else {
fprintf(stderr, "exiting, no ASCII hex found\n");
return 0; // finished! #TODO
}
}
else {
if(strlen(byteString) > BYTE_BUFFER_SIZE*2) {
fprintf(stderr, "Max ascii string size is %d you provided: %lu chars. Exiting.\n", BYTE_BUFFER_SIZE*2,
strlen(byteString));
exit(-1);
}
strncpy(byteStringBuffer, byteString, BYTE_BUFFER_SIZE*2);
stdin_mode = 0; // break out of the while loop
}
int size = strlen(byteStringBuffer);
if((size % 2) != 0){
fprintf(stderr, "need even-number of ascii chars for byte-stream: (offset: %08lx, %s, %ld)\n", offset, byteStringBuffer, strlen(byteStringBuffer));
exit(-1);
}View on GitHub (pinned to d5f144c24d)
Solutions
- Ensure the stdin input supplies both an address line and a bytes line before EOF.
- If interactive, type or paste the hex byte string instead of closing the stream.
- Fix the upstream producer so it always emits the bytes line.
- Use argument mode (argc >= 8) instead of stdin mode for deterministic input.
Example fix
# before (stdin truncated) $ printf '400000\n' | gdis ... # only address line -> no ASCII hex found # after (address + bytes) $ printf '400000\n90909090\n' | gdis ...
Defensive patterns
Strategy: validation
Validate before calling
// ensure stdin input has both lines before processing
if (!fgets(addr, sizeof addr, stdin) || !fgets(bytes, sizeof bytes, stdin)) {
return 0; // treat as clean EOF
} Prevention
- Producers must always emit address + bytes lines.
- Prefer argument mode for deterministic inputs.
- Detect EOF cleanly rather than treating it as an error.
When it happens
Trigger: Running gdis in interactive/stdin mode and closing the input stream (Ctrl-D) after the address line but before supplying a byte string; piping an input file whose second line is missing or empty.
Common situations: Interactive disassembly session ended by the user; a piped input file truncated to only the address line; a producer process closing its stdout early.
Related errors
- Usage: %s target-str, arch, mach, disassembly base-addr (for
- Max ascii string size is %d you provided: %lu chars. Exiting
- need even-number of ascii chars for byte-stream: (offset: %0
- %s: unrecognized option `--%s'
- %s: unrecognized option `%c%s'
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/44969be81e14bf56.
Report an issue: GitHub.