[poppler] [PATCH] Fix GDir's handling of return values from FindFirstFile

Albert Astals Cid aacid at kde.org
Thu Apr 3 11:06:30 PDT 2008


A Dijous 03 Abril 2008, Adam Batkin va escriure:
> Hi,
>
> I believe that there is a small bug in GDir's Windows implementation, if
> called on a directory that does not exist and you then try to enumerate
> its entries (getNextEntry()).
>
> Basically GDir was storing the return value of its call to
> FindFirstFile() in GDir::hnd, but using NULL as a sentinel for invalid
> values, but in fact FindFirstFile() returns INVALID_HANDLE_VALUE (-1).
>
> This patch replaces assignments to NULL with assignments to
> INVALID_HANDLE_VALUE and all checks now check against
> INVALID_HANDLE_VALUE instead of NULL.
>
> So if you are ever using poppler on Windows and your app suddenly
> crashes (which I was only able to do by compiling with all the debugging
> options turned on, otherwise I only got funny entries in my log like
> "Error: Couldn't open 'nameToUnicode' file
> 'D:\kde-mingw\share\poppler\nameToUnicode\{„žYø!'") this may be why.
>
> You know what would also be nice...(would you be open to a patch?) not
> hardcoding POPPLER_DATADIR, since especially on Windows you never know
> where it will be installed.

Patch pushed to the repo.

And we are always open to interesting patches, but what are you going to do to 
search for the POPPLER_DATADIR? Check each and every directory?

Albert

>
> I hope this helps (and I hope I did everything properly...),
>
> -Adam Batkin




More information about the poppler mailing list