{"record":{"id":"14e8406e710766f2","repo":"DrKLO/Telegram","slug":"invalid-scan-entry-format-in-file-s","errorCode":null,"errorMessage":"Invalid scan entry format in file %s\n","messagePattern":"Invalid scan entry format in file (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/rdswitch.c","lineNumber":245,"sourceCode":"      if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')\n        goto bogus;\n      scanptr->Se = (int) val;\n      if (! read_scan_integer(fp, &val, &termchar) || termchar != ' ')\n        goto bogus;\n      scanptr->Ah = (int) val;\n      if (! read_scan_integer(fp, &val, &termchar))\n        goto bogus;\n      scanptr->Al = (int) val;\n    } else {\n      /* set non-progressive parameters */\n      scanptr->Ss = 0;\n      scanptr->Se = DCTSIZE2-1;\n      scanptr->Ah = 0;\n      scanptr->Al = 0;\n    }\n    if (termchar != ';' && termchar != EOF) {\nbogus:\n      fprintf(stderr, \"Invalid scan entry format in file %s\\n\", filename);\n      fclose(fp);\n      return FALSE;\n    }\n    scanptr++, scanno++;\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  if (scanno > 0) {\n    /* Stash completed scan list in cinfo structure.\n     * NOTE: for cjpeg's use, JPOOL_IMAGE is the right lifetime for this data,\n     * but if you want to compress multiple images you'd want JPOOL_PERMANENT.\n     */\n    scanptr = (jpeg_scan_info *)","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/rdswitch.c#L227-L263","documentation":"The scan definition parser expects each entry to follow the format: component indices (space-separated), optional ': Ss Se Ah Al' for progressive parameters, terminated by ';' or EOF. If the terminating character after parsing an entry is neither ';' nor EOF (or if read_scan_integer fails during progressive parameter parsing), execution jumps to the 'bogus' label and reports an invalid scan entry format.","triggerScenarios":"A scan entry with incorrect syntax: wrong separator character (e.g., using ',' instead of ' '), missing semicolon between entries, or malformed progressive parameters after the colon. Also triggered when read_scan_integer fails during the Ss/Se/Ah/Al field parsing.","commonSituations":"Hand-written scan scripts with syntax errors; scan files copied from a different format; trailing characters after a valid scan entry; using a colon but not providing all four progressive parameters (Ss Se Ah Al); encoding issues introducing invisible characters.","solutions":["Follow the exact format: component indices separated by spaces, then optional ': Ss Se Ah Al', terminated by ';'.","Example valid entry: '0 1 2: 0 0 0 0;' (components 0,1,2, progressive params Ss=0 Se=0 Ah=0 Al=0).","Use a known-good scan script template and modify values carefully.","Validate the file for stray non-ASCII characters or incorrect separators."],"exampleFix":"# before (invalid: missing semicolon, wrong separator)\n0,1,2: 0 0 0 0\n# after (valid)\n0 1 2: 0 0 0 0;","handlingStrategy":"validation","validationCode":"// Pre-validate scan entry syntax: components then optional ': Ss Se Ah Al' then ';'\nstatic boolean validate_scan_syntax(const char *filename) {\n  FILE *fp = fopen(filename, \"r\");\n  if (!fp) return FALSE;\n  int c;\n  boolean ok = TRUE;\n  while ((c = fgetc(fp)) != EOF) {\n    if (c == ',') ok = FALSE; // commas are invalid separators\n  }\n  fclose(fp);\n  return ok;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a known-good scan script template and only modify numeric values.","Ensure component indices are space-separated, not comma-separated.","Verify each scan entry ends with ';' except possibly the last (which can end with EOF).","Test scan scripts on small images before using them in production pipelines."],"tags":["validation","scan-definition","syntax-error","mozjpeg"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}