2019.04.23 18:55 "[Tiff] TIFFWriteScanLine - buffers to RAM before flushing to disc?", by Paul Hemmer

2019.06.20 07:38 "[Tiff] TIFFFdOpen crash on Windows 64bit", by ZdPo Ster

Hello,

When I try to use TIFFFdOpen on Windows 10 64bit - but it crash. In

attachment there is my testing code. I found this problem when I was

testing poppler[1] utility pdftoppm (to convert pdf to tif).

IMO this is relevant to Bug 1941 - Win64 problem with tif_win32.c's

TIFFOpen() use of HANDLE (w/patch)[3],

Unfortunately " Bugzilla has suffered an internal error", so new account can not be created e.g. I can not comment it there too.

Does anybody has the same experience or is there workaround for this?

I use the latest code[4] build with cmake and clang (version 9.0.0 (trunk) Target: x86_64-pc-windows-msvc).

[1] https://gitlab.freedesktop.org/poppler/poppler/blob/master/goo/TiffWriter.cc#L167 [2] https://gitlab.freedesktop.org/poppler/poppler/blob/master/utils/pdftoppm.cc [3] http://bugzilla.maptools.org/show_bug.cgi?id=1941 [4] https://gitlab.com/libtiff/libtiff

/*
Build command:
    clang-cl crash_win_tiff.cc -IF:/win64_llvm/include F:\win64_llvm\lib\tiff.lib -D_CRT_SECURE_NO_WARNINGS

Related to:
    http://bugzilla.maptools.org/show_bug.cgi?id=1941
*/

#include <io.h>
#include <stdio.h>
#include <tiffio.h>

int main(int argc, char* argv[]) {

    const char *filename = "test.tif";
    FILE *fp = fopen ( filename, "r" );
    TIFF *tif;

    if ( fp == NULL ) {
        fprintf(stderr, "Failed to open file\n" );
        return 1;
    }
#if defined(_WIN32)
    fprintf(stdout, "TIFFFdOpen will be started\n" );
    tif = TIFFFdOpen(_get_osfhandle(_fileno(fp)), "temp", "r");
    fprintf(stdout, "tif created\n" );
#else
    tif = TIFFFdOpen(fileno(fp), "temp", "r");
#endif
    TIFFClose(tif);
    return 0;
}