Ticket #2881 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

BSBDataset::open() function may consider a non-BSB file as a BSB file

Reported by: Kasulle Owned by: warmerdam
Priority: normal Milestone: 1.6.1
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

GDAL Version 1.6 When i use GDALOpen() to open an bmp file, GDAL reports a error message like this: "ERROR 1: Failed to find required RGB/ or BSB/ keyword in header." but I found that this is a BSB format errror message.

================================================================================== BSBDataset::open() {

if( poOpenInfo->nHeaderBytes < 1000 )

return NULL;

for( i = 0; i < poOpenInfo->nHeaderBytes - 4; i++ ) {

if( poOpenInfo->pabyHeader[i+0] == 'B'

&& poOpenInfo->pabyHeader[i+1] == 'S' && poOpenInfo->pabyHeader[i+2] == 'B' && poOpenInfo->pabyHeader[i+3] == '/' ) break;

if( poOpenInfo->pabyHeader[i+0] == 'N'

&& poOpenInfo->pabyHeader[i+1] == 'O' && poOpenInfo->pabyHeader[i+2] == 'S' && poOpenInfo->pabyHeader[i+3] == '/' )

{

isNos = true; break;

} if( poOpenInfo->pabyHeader[i+0] == 'W'

&& poOpenInfo->pabyHeader[i+1] == 'X' && poOpenInfo->pabyHeader[i+2] == '\\' && poOpenInfo->pabyHeader[i+3] == '8' ) break;

}

} ==================================================================================== if the 1000 bytes in one file has a sequence "NOS/", the file is considered as a NOS file, but in fact, this is a bmp file and occasionally has a "NOS/" sequence in 1000 bytes

Attachments

bb.bmp Download (0.8 MB) - added by Kasulle 3 years ago.
a bmp file but considered as a NOS file by BSB driver

Change History

Changed 3 years ago by Kasulle

a bmp file but considered as a NOS file by BSB driver

follow-up: ↓ 2   Changed 3 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed

Fixed in trunk (r16539) and in branches/1.6 (r16540). In the meantime you can workaround by skipping the BSB driver with the GDAL_SKIP configuration option :

GDAL_SKIP=BSB gdalinfo bb.bmp

in reply to: ↑ 1   Changed 3 years ago by Kasulle

Replying to rouault:

Fixed in trunk (r16539) and in branches/1.6 (r16540). In the meantime you can workaround by skipping the BSB driver with the GDAL_SKIP configuration option : GDAL_SKIP=BSB gdalinfo bb.bmp

thanks

Note: See TracTickets for help on using tickets.