{"record":{"id":"44969be81e14bf56","repo":"NationalSecurityAgency/ghidra","slug":"exiting-no-ascii-hex-found-n","errorCode":null,"errorMessage":"exiting, no ASCII hex found\\n","messagePattern":"exiting, no ASCII hex found\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"GPL/GnuDisassembler/src/gdis/c/disasm_1.c","lineNumber":360,"sourceCode":"\t\t\t\t\tstrncpy(byteStringBuffer,bytesAndOptionsBuffer,(int) (p - bytesAndOptionsBuffer));\n\t\t\t\t\tstrncpy(disassemblerOptions,p+1,sizeof(disassemblerOptions));\n\t\t\t\t\tp = strchr(disassemblerOptions,'\\n');\n\t\t\t\t\tif (p){\n\t\t\t\t\t\t*p = '\\0';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t//no \"*\" in the string, so no disassembly options\n\t\t\t\t\t//replace newline with null terminator\n\t\t\t\t\tstrncpy(byteStringBuffer, bytesAndOptionsBuffer, sizeof(byteStringBuffer));\n\t\t\t\t\tp = strchr(byteStringBuffer,'\\n');\n\t\t\t\t\tif (p){\n\t\t\t\t\t\t*p = '\\0';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfprintf(stderr, \"exiting, no ASCII hex found\\n\");\n\t\t\t\treturn 0; // finished! #TODO\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tif(strlen(byteString) > BYTE_BUFFER_SIZE*2) {\n\t\t\t\tfprintf(stderr, \"Max ascii string size is %d you provided: %lu chars. Exiting.\\n\", BYTE_BUFFER_SIZE*2,\n\t\t\t\t\t\tstrlen(byteString));\n\t\t\t\texit(-1);\n\t\t\t}\n\t\t\tstrncpy(byteStringBuffer, byteString, BYTE_BUFFER_SIZE*2);\n\t\t\tstdin_mode = 0; // break out of the while loop\n\t\t}\n\n\t\tint size = strlen(byteStringBuffer);\n\t\tif((size % 2) != 0){\n\t\t\tfprintf(stderr, \"need even-number of ascii chars for byte-stream: (offset: %08lx, %s, %ld)\\n\", offset, byteStringBuffer, strlen(byteStringBuffer));\n\t\t\texit(-1);\n\t\t}","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/GPL/GnuDisassembler/src/gdis/c/disasm_1.c#L342-L378","documentation":"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.","triggerScenarios":"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.","commonSituations":"Interactive disassembly session ended by the user; a piped input file truncated to only the address line; a producer process closing its stdout early.","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."],"exampleFix":"# before (stdin truncated)\n$ printf '400000\\n' | gdis ...   # only address line -> no ASCII hex found\n\n# after (address + bytes)\n$ printf '400000\\n90909090\\n' | gdis ...","handlingStrategy":"validation","validationCode":"// ensure stdin input has both lines before processing\nif (!fgets(addr, sizeof addr, stdin) || !fgets(bytes, sizeof bytes, stdin)) {\n  return 0; // treat as clean EOF\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Producers must always emit address + bytes lines.","Prefer argument mode for deterministic inputs.","Detect EOF cleanly rather than treating it as an error."],"tags":["cli","disassembler","stdin","c"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}