I used GDAL RasterIO to read multi-band geotiff, when I apply it to the same band, it is ok, but when I appply it to tow different bands, the error occurs.
GDALRasterBand *tmpBand1 = img_sar->GetRasterBand(1);
GDALRasterBand *tmpBand2 = img_sar->GetRasterBand(2);
int cols = img_sar->GetRasterXSize();
int ligs = img_sar->GetRasterYSize();
tmpBand1->RasterIO(GF_Read,0,0,cols,1,tmp,cols,1,GDT_Float32,0,0);//it is ok
tmpBand2->RasterIO(GF_Read,0,0,cols,1,tmp,cols,1,GDT_Float32,0,0);//the error occurs this line