View Issue Details

IDProjectCategoryView StatusLast Update
0003131FSSCPscriptingpublic2014-11-24 14:47
Reporterm_m Assigned Tom_m  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.7.1 
Target Version3.7.2 
Summary0003131: Having an empty action code block in a scripting table causes a crash
DescriptionAn empty lua action block (see uploaded scripting table) causes a rash while parsing the table.
TagsNo tags attached.

Activities

m_m

2014-11-24 09:14

developer  

require-sct.tbm (82 bytes)

m_m

2014-11-24 09:18

developer   ~0016402

alloc_block returns a NULL pointer when the parsed block is empty. That value should only be returned when a serious error was detected (in this case vm_malloc failed to allocate memory).
The uploaded patch fixes this behavior by removing that condition.

m_m

2014-11-24 09:18

developer  

3131.patch (524 bytes)   
Index: code/parse/parselo.cpp
===================================================================
--- code/parse/parselo.cpp	(revision 11178)
+++ code/parse/parselo.cpp	(working copy)
@@ -1096,11 +1096,6 @@
 		//Set final length for faster calcs
 		flen = pos-Mp;
 
-		// if we don't have anything to read then bail
-		if (flen <= 0) {
-			return NULL;
-		}
-
 		//Allocate the memory
 		//WMC - Don't forget the null character that's added later on.
 		rval = (char*) vm_malloc((flen + extra_chars + 1)*sizeof(char));
3131.patch (524 bytes)   

Goober5000

2014-11-24 14:47

administrator   ~0016403

Fix committed to trunk@11179.

Related Changesets

fs2open: trunk r11179

2014-11-24 10:34

Goober5000


Ported: N/A

Details Diff
m!m's fix for Mantis 0003131: contrary to the xt change from r11138, NULL is only returned on vm_malloc failure (so should never happen in normal execution) Affected Issues
0003131
mod - /trunk/fs2_open/code/parse/parselo.cpp Diff File

Issue History

Date Modified Username Field Change
2014-11-24 09:14 m_m New Issue
2014-11-24 09:14 m_m Status new => assigned
2014-11-24 09:14 m_m Assigned To => m_m
2014-11-24 09:14 m_m File Added: require-sct.tbm
2014-11-24 09:18 m_m Note Added: 0016402
2014-11-24 09:18 m_m Status assigned => code review
2014-11-24 09:18 m_m File Added: 3131.patch
2014-11-24 14:47 Goober5000 Changeset attached => fs2open trunk r11179
2014-11-24 14:47 Goober5000 Note Added: 0016403
2014-11-24 14:47 Goober5000 Status code review => resolved
2014-11-24 14:47 Goober5000 Resolution open => fixed