{"record":{"id":"d0ddf9fda28cb0b7","repo":"DrKLO/Telegram","slug":"non-numeric-data-in-file-s","errorCode":null,"errorMessage":"Non-numeric data in file %s\n","messagePattern":"Non-numeric data in file (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/rdswitch.c","lineNumber":129,"sourceCode":"      if (! read_text_integer(fp, &val, &termchar)) {\n        fprintf(stderr, \"Invalid table data in file %s\\n\", filename);\n        fclose(fp);\n        return FALSE;\n      }\n      table[i] = (unsigned int) val;\n    }\n#if JPEG_LIB_VERSION >= 70\n    jpeg_add_quant_table(cinfo, tblno, table, cinfo->q_scale_factor[tblno],\n                         force_baseline);\n#else\n    jpeg_add_quant_table(cinfo, tblno, table, q_scale_factor[tblno],\n                         force_baseline);\n#endif\n    tblno++;\n  }\n\n  if (termchar != EOF) {\n    fprintf(stderr, \"Non-numeric data in file %s\\n\", filename);\n    fclose(fp);\n    return FALSE;\n  }\n\n  fclose(fp);\n  return TRUE;\n}\n\n\n#ifdef C_MULTISCAN_FILES_SUPPORTED\n\nLOCAL(boolean)\nread_scan_integer (FILE *file, long *result, int *termchar)\n/* Variant of read_text_integer that always looks for a non-space termchar;\n * this simplifies parsing of punctuation in scan scripts.\n */\n{\n  register int ch;","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/rdswitch.c#L111-L147","documentation":"After reading all quantization tables, read_quant_tables checks the terminating character. If termchar is not EOF, it means there is leftover non-numeric data in the file after the valid table content -- likely a formatting error. The function reports non-numeric data, closes the file, and returns FALSE. This catches trailing garbage that is not a valid integer.","triggerScenarios":"A quantization table file with trailing non-numeric text after the last complete table; a stray character or comment that is not properly formatted; extra data after the final table's 64th value that read_text_integer cannot parse as an integer.","commonSituations":"Files with inline comments not prefixed with '#'; copy-paste artifacts at the end of the file; files saved with extra blank lines or special characters after the data; editing tools that append metadata.","solutions":["Open the table file and remove any trailing non-numeric content after the last table's 64th value.","Ensure comments only use the '#' prefix, which read_text_integer handles correctly.","Re-save the file ensuring it contains only whitespace-separated integers and '#' comments."],"exampleFix":"# before: table file ends with \"64128 garbage_text\"\n# after: table file ends with \"64 128\" and nothing else\n# Remove trailing non-numeric lines\nsed -i '/[^0-9[:space:]-]/d' table.qtl","handlingStrategy":"validation","validationCode":"// Pre-validate: ensure the file contains only numbers and # comments\n#include <stdio.h>\nstatic boolean check_trailing_garbage(const char *filename) {\n  FILE *fp = fopen(filename, \"r\");\n  if (!fp) return FALSE;\n  long val; int termchar;\n  read_text_integer(fp, &val, &termchar);\n  boolean clean = (termchar == EOF);\n  fclose(fp);\n  return clean;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure table files end with clean numeric data or '#' comments only.","Run tail -c 1 file.qtl with xxd to check for trailing non-numeric bytes.","Use file generation scripts rather than manual editing to avoid trailing artifacts."],"tags":["validation","quantization","malformed-data","mozjpeg"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}