Ticket #2881 (closed defect: fixed)
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

