Opened 8 years ago
Closed 8 years ago
#6271 closed defect (fixed)
ECRG: error in base34 decoding and in Windows filename handling
Reported by: | Even Rouault | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.4 |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
Reported by Damian Dixon
I have a couple of ECRG fixes that I would like to push back. The check is slightly wrong for the base34 change. '=' signs are required in two places. static GIntBig GetFromBase34(const char* pszVal, int nMaxSize) { int i; GIntBig nFrameNumber = 0; for(i=0;i<nMaxSize;i++) { char ch = pszVal[i]; if (ch == '\0') break; int chVal; if (ch >= 'A' && ch <= 'Z') ch += 'a' - 'A'; /* i and o letters are excluded, */ if (ch >= '0' && ch <= '9') chVal = ch - '0'; else if (ch >= 'a' && ch <= 'h') chVal = ch - 'a' + 10; else if (ch >= 'j' && ch <= 'n') chVal = ch - 'a' + 10 - 1; else if (ch >= 'p' && ch <= 'z') chVal = ch - 'a' + 10 - 2; else { CPLDebug("ECRG", "Invalid base34 value : %s", pszVal); break; } nFrameNumber = nFrameNumber * 34 + chVal; } return nFrameNumber; } If we try and read data from say 'D:' on Windows then the path becomes invalid: GDALDataset *ECRGTOCDataset::Open( GDALOpenInfo * poOpenInfo ) { .... if( nTokens == 3 ) osFilename = papszTokens[2]; else if( nTokens == 4 ) { if( strlen(papszTokens[2]) == 1 && (papszTokens[3][0] == '\\' || papszTokens[3][0] == '/') ) { osFilename = papszTokens[2]; osFilename += ":"; // envitia osFilename += papszTokens[3]; // envitia end } else { osScale = papszTokens[2]; osFilename = papszTokens[3]; } } else if( nTokens == 5 && strlen(papszTokens[3]) == 1 && (papszTokens[4][0] == '\\' || papszTokens[4][0] == '/') ) { osScale = papszTokens[2]; osFilename = papszTokens[3]; osFilename += ":"; // envitia osFilename += papszTokens[4]; // envitia end }
Change History (1)
comment:1 by , 8 years ago
Milestone: | → 1.11.4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
trunk r32231, branches/2.0 r32232, branches/1.11 r32233 "ECRG: fix base34 decoding and Windows filename handling (patch by Damian Dixon, #6271)"