{"record":{"id":"dc1f8004b07e85e0","repo":"DrKLO/Telegram","slug":"s-can-t-read-from-s-n","errorCode":null,"errorMessage":"%s: can't read from %s\\n","messagePattern":"(.+?): can't read from (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"TMessagesProj/jni/mozjpeg/djpeg.c","lineNumber":623,"sourceCode":"\n#ifdef PROGRESS_REPORT\n  start_progress_monitor((j_common_ptr)&cinfo, &progress);\n#endif\n\n  /* Specify data source for decompression */\n#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)\n  if (memsrc) {\n    size_t nbytes;\n    do {\n      inbuffer = (unsigned char *)realloc(inbuffer, insize + INPUT_BUF_SIZE);\n      if (inbuffer == NULL) {\n        fprintf(stderr, \"%s: memory allocation failure\\n\", progname);\n        exit(EXIT_FAILURE);\n      }\n      nbytes = JFREAD(input_file, &inbuffer[insize], INPUT_BUF_SIZE);\n      if (nbytes < INPUT_BUF_SIZE && ferror(input_file)) {\n        if (file_index < argc)\n          fprintf(stderr, \"%s: can't read from %s\\n\", progname,\n                  argv[file_index]);\n        else\n          fprintf(stderr, \"%s: can't read from stdin\\n\", progname);\n      }\n      insize += (unsigned long)nbytes;\n    } while (nbytes == INPUT_BUF_SIZE);\n    fprintf(stderr, \"Compressed size:  %lu bytes\\n\", insize);\n    jpeg_mem_src(&cinfo, inbuffer, insize);\n  } else\n#endif\n    jpeg_stdio_src(&cinfo, input_file);\n\n  /* Read file header, set default decompression parameters */\n  (void)jpeg_read_header(&cinfo, TRUE);\n\n  /* Adjust default decompression parameters by re-parsing the options */\n  file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);\n","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/djpeg.c#L605-L641","documentation":"During in-memory source loading, a JFREAD of the input FILE returned fewer than INPUT_BUF_SIZE bytes AND ferror() is set, signalling an I/O read failure (not a clean EOF). The error names the offending input file path. Note the loop still continues; this is diagnostic, not an exit.","triggerScenarios":"Reading from a file on a failing/unmounted filesystem, a network mount that drops, a truncated file on a hot-unplugged device, or any condition where the FILE stream sets its error indicator. Emitted only when file_index < argc (explicit filename), inside the memsrc read loop.","commonSituations":"Input on removable storage removed mid-read, NFS/SMB mount timeout, corrupted storage, or a pipe/FIFO closed early by the producer. The message is advisory: decompression proceeds with whatever was read and may fail later.","solutions":["Verify the source file integrity (cmp, md5sum against a known copy) before decoding.","Remount or restore the storage and re-run; transient I/O errors are common on flaky mounts.","Copy the input to local stable storage first, then decode the copy.","If using a pipe/FIFO, ensure the producer writes the full stream to completion."],"exampleFix":"// before: decode directly from flaky mount\n./djpeg -memsrc /mnt/net/in.jpg > out.ppm\n// after: stage locally first\ncp /mnt/net/in.jpg /tmp/in.jpg && ./djpeg -memsrc /tmp/in.jpg > out.ppm","handlingStrategy":"validation","validationCode":"#include <sys/stat.h>\n/* verify file integrity hint: non-zero size, readable */\nint input_looks_ok(const char *p) {\n  struct stat st;\n  return stat(p,&st)==0 && S_ISREG(st.st_mode) && st.st_size>0 && access(p,R_OK)==0;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Stage inputs from flaky mounts to local stable storage before decoding.","For network sources, download fully before invoking djpeg.","Treat a short read as a sign to retry from a known-good copy."],"tags":["file-io","djpeg","memsrc","read-error","mozjpeg"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}