--- parser3/src/main/pa_dir.C 2026/10/02 19:58:41 1.40 +++ parser3/src/main/pa_dir.C 2026/10/11 17:06:44 1.41 @@ -12,7 +12,7 @@ #include "pa_request.h" #include "pa_convert_utf.h" -volatile const char * IDENT_PA_DIR_C="$Id: pa_dir.C,v 1.40 2026/10/02 19:58:41 moko Exp $" IDENT_PA_DIR_H; +volatile const char * IDENT_PA_DIR_C="$Id: pa_dir.C,v 1.41 2026/10/11 17:06:44 moko Exp $" IDENT_PA_DIR_H; #ifdef _MSC_VER @@ -36,6 +36,10 @@ bool findfirst(const char* _pathname, st snprintf(mask, MAXPATH, "%s/*.*", _pathname); const UTF16* utf16mask=pa_utf16_encode(mask, pa_thread_request().charsets.source()); + if(!utf16mask) { // not UTF-8, there can't be such a directory + errno=ENOENT; + return false; + } _ffblk->handle=FindFirstFileW((const wchar_t *)utf16mask, &_ffblk->stat); return !pa_set_errno(_ffblk->handle!=INVALID_HANDLE_VALUE); // errno as opendir sets it