Ticket #3607 (closed defect: fixed)
VSIFileFromMemBuffer does not call NormalizePath before adding to oFileList
| Reported by: | des4maisons | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.8.0 |
| Component: | default | Version: | 1.7.2 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
In port/cpl_vsi_mem.cpp, in VSIFileFromMemBuffer() line 736, NormalizePath? is not called on the input filename before adding it to oFileList. This means that if a path comes in with a '\', it gets added to FileList? map as is. However, the Open call at the end of the function normalizes the filename before checking to see if it's in oFileList, so it doesn't find the file. Therefore this always fails:
FILE* fp = VSIFileFromMemBuffer("/vsimem\hello", my_ptr, 100, FALSE);
ASSERT(fp);
A fix would be to call NormalizePath? on the filename given to VSIFileFromMemBuffer before using it.
Change History
Note: See
TracTickets for help on using
tickets.
