Skip to content

Commit c8ec4ca

Browse files
committed
Add validation for StartSection
* The index is required to be within the bounds of the Code Section array.
1 parent fd69d8b commit c8ec4ca

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

TBInit.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,15 @@ def ExportSection(self):
273273
return(True)
274274

275275
def StartSection(self):
276-
pass
276+
section = self.module.start_section
277+
if section is None:
278+
return(True)
279+
index = section.function_section_index[0]
280+
csection = self.module.CodeSection
281+
if index >= len(csection.func_bodies):
282+
return(False)
283+
#func = self.module.function_index_space[index]
284+
return(True)
277285

278286
def ElementSection(self):
279287
pass
@@ -302,7 +310,8 @@ def ValidateAll(self):
302310
return(False)
303311
if not self.ExportSection():
304312
return(False)
305-
self.StartSection()
313+
if not self.StartSection():
314+
return(False)
306315
self.ElementSection()
307316
self.CodeSection()
308317
self.DataSection()

0 commit comments

Comments
 (0)