View Issue Details

IDProjectCategoryView StatusLast Update
0005808DarkRadiantSaving and loadingpublic14.11.2021 10:39
Reporterjonri Assigned Togreebo  
PrioritylowSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux 
Product Version2.14.0 
Target Version2.14.0Fixed in Version2.14.0 
Summary0005808: Crash when saving map or prefab without a file extension
DescriptionWhen using the "Export selected as Map" or "Export selected as Prefab" options from the File menu, entering a name without a file extension will result in a segfault. The "format" parameter in MapResource::saveFile is a dereferenced null pointer. Presumably this data is derived from the file extension, which is not present. I also tried adding a nonsense extension (i.e. myprefab.wtf) which also resulted in the same crash

In many pieces of software, it is customary for the file extension selected in the save dialog to get automatically applied if it is missing from the requested filename. It's entirely possible this happens on Windows but not Linux; however, using "Export selected as model" does warn if the filename does not end with the proper extension (but lets you continue anyways) so it was thought of somewhere. And for completeness, "Export Map" will successfully create a file without an extension.

I'd suggest at least standardizing all save dialogs to add the selected extension when none is present, maybe even enforcing the correct extension unless it makes sense not to.

Steps To ReproduceUse the "Export selected as Map" or "Export selected as Prefab" options from the File menu, and enter a name without a file extension.
TagsNo tags attached.

Activities

greebo

greebo

14.11.2021 06:06

administrator   ~0014540

While I can't get it to crash in Windows (it seems the file dialog is doing a better job at assigning the default extension), I can confirm that the Map::saveSelected routine is vulnerable against paths without extension - the format cannot be determined, and the crash follows.

Related Changesets

DarkRadiant: master 00fc6d3a

2021-11-14 08:04:06

greebo

Details Diff
0005808: Craft a unit test confirming the crash when the file extension is empty and no format was selected in the dialog (e.g. "*.*") Affected Issues
0005808
mod - test/MapExport.cpp Diff File

DarkRadiant: master 0fef59f2

2021-11-14 08:33:25

greebo

Details Diff
0005808: Map::saveSelected falls back to the currently active map format if none is specified Affected Issues
0005808
mod - radiantcore/map/Map.cpp Diff File
mod - test/MapExport.cpp Diff File

DarkRadiant: master 0923a9b0

2021-11-14 09:52:07

greebo

Details Diff
0005808: Extend the map format fallback to all other clients of MapResource::saveFile. Affected Issues
0005808
mod - radiantcore/map/Map.cpp Diff File
mod - radiantcore/map/Map.h Diff File
mod - radiantcore/map/RegionManager.cpp Diff File

Issue History

Date Modified Username Field Change
13.11.2021 03:31 jonri New Issue
13.11.2021 04:57 greebo Status new => acknowledged
14.11.2021 06:06 greebo Status acknowledged => confirmed
14.11.2021 06:06 greebo Note Added: 0014540
14.11.2021 08:34 greebo Assigned To => greebo
14.11.2021 08:34 greebo Status confirmed => assigned
14.11.2021 09:52 greebo Changeset attached => DarkRadiant master 00fc6d3a
14.11.2021 09:52 greebo Changeset attached => DarkRadiant master 0fef59f2
14.11.2021 09:52 greebo Changeset attached => DarkRadiant master 0923a9b0
14.11.2021 10:39 greebo Target Version => 2.14.0
14.11.2021 10:39 greebo Status assigned => resolved
14.11.2021 10:39 greebo Resolution open => fixed
14.11.2021 10:39 greebo Fixed in Version => 2.14.0