Ticket #3607 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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

Changed 3 years ago by rouault

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

Fixed in trunk in r19784

Note: See TracTickets for help on using tickets.