[gdal-dev] CPLScanPointer doesn't do its job rightly when compiled in MSYS environment

Ari Jolma ari.jolma at tkk.fi
Sat Nov 1 13:13:20 EDT 2008


Even Rouault kirjoitti:
> Ari,
>
> fopr the crash in MEMRasterBand::IReadBlock(), I would suspect that 
> CPLScanPointer doesn't do its job rightly when compiled in MSYS environment.
>
> The function looks currently like :
>
> /* -------------------------------------------------------------------- */
> /*      On MSVC we have to scanf pointer values without the 0x          */
> /*      prefix.                                                         */
> /* -------------------------------------------------------------------- */
>     if( EQUALN(szTemp,"0x",2) )
>     {
>         pResult = NULL;
>
> #if defined(WIN32) && defined(_MSC_VER)
>         sscanf( szTemp+2, "%p", &pResult );
> #else
>         sscanf( szTemp, "%p", &pResult );
> #endif
>     }
>
> I'd guess we probably don't need the defined(_MSC_VER) test
>   

I can confirm this. A simple copy to memory raster causes a segfault:

$tst = Geo::GDAL::Open('gdal-autotest/gdrivers/data/39079G6_truncated.dem');
$tst->GetDriver->Copy('MEM',$tst);

but when removing the above test, this code works fine. szTemp contains 
prefix "0x" in MSYS.

A ticket and a bug fix is probably in order.

Regards,

Ari

-- 
Prof. Ari Jolma
Environmental Management Information Technology
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 4511 address: POBox 5300, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://geoinformatics.tkk.fi




More information about the gdal-dev mailing list