{"record":{"id":"87e38dd8febc122d","repo":"DrKLO/Telegram","slug":"invalid-path-to-yuv-file-n","errorCode":null,"errorMessage":"Invalid path to YUV file!\\n","messagePattern":"Invalid path to YUV file!\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"TMessagesProj/jni/mozjpeg/yuvjpeg.c","lineNumber":152,"sourceCode":"  if (matches != 2) {\n    fprintf(stderr, \"Invalid image size input!\\n\");\n    return 1;\n  }\n  if (luma_width <= 0 || luma_height <= 0) {\n    fprintf(stderr, \"Invalid image size input!\\n\");\n    return 1;\n  }\n\n  chroma_width = (luma_width + 1) >> 1;\n  chroma_height = (luma_height + 1) >> 1;\n\n  /* Will check these for validity when opening via 'fopen'. */\n  yuv_path = argv[3];\n  jpg_path = argv[4];\n\n  yuv_fd = fopen(yuv_path, \"r\");\n  if (!yuv_fd) {\n    fprintf(stderr, \"Invalid path to YUV file!\\n\");\n    return 1;\n  }\n\n  fseek(yuv_fd, 0, SEEK_END);\n  yuv_size = ftell(yuv_fd);\n  fseek(yuv_fd, 0, SEEK_SET);\n\n  /* Check that the file size matches 4:2:0 yuv. */\n  if (yuv_size !=\n   (size_t)luma_width*luma_height + 2*chroma_width*chroma_height) {\n    fclose(yuv_fd);\n    fprintf(stderr, \"Unexpected input format!\\n\");\n    return 1;\n  }\n\n  yuv_buffer = malloc(yuv_size);\n  if (!yuv_buffer) {\n    fclose(yuv_fd);","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/mozjpeg/yuvjpeg.c#L134-L170","documentation":"yuvjpeg opens the YUV input via fopen(yuv_path, \"r\"). If fopen returns NULL it prints `Invalid path to YUV file!` and returns 1. This is an input-file open failure for the raw YUV source, independent of format checks that follow.","triggerScenarios":"Running `yuvjpeg <q> <size> <yuv_in> <jpg_out>` where <yuv_in> does not exist, is unreadable, or is not a regular file.","commonSituations":"Wrong path/extension, file on an unmounted volume, permission denied (common in the Android JNI/TMessagesProj context), or a path with spaces passed unquoted.","solutions":["Verify the YUV path is readable: `test -r <yuv_in>`.","Use an absolute path and quote paths with spaces.","Check permissions/SELinux context of the file.","Confirm the file is a real raw YUV file, not a JPEG or container."],"exampleFix":"// before\nyuvjpeg 90 512x512 frame.yuv out.jpg   # frame.yuv missing\n// after\nyuvjpeg 90 512x512 /data/yuv/frame.yuv out.jpg","handlingStrategy":"validation","validationCode":"#include <unistd.h>\n/* YUV input must be readable */\nif (access(yuv_path, R_OK) != 0) { /* report and do not invoke yuvjpeg */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the YUV path is readable (test -r) before invoking.","Use absolute, quoted paths.","Confirm the file is raw YUV, not a JPEG/container."],"tags":["cli","jpeg","mozjpeg","yuvjpeg","file-io","input-validation"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}