Commit 425a038a60600a3f15b78671c95f1922264dbe2a

Authored by Vincent Brillault
1 parent 1b3768ad

oleform: fail cleanly in case of unsupported content

Showing 1 changed file with 2 additions and 3 deletions
oletools/oleform.py
... ... @@ -201,7 +201,7 @@ def consume_OleSiteConcreteControl(stream):
201 201 name = stream.read(name_len)
202 202 tag = stream.read(tag_len)
203 203 return {'name': name, 'tag': tag, 'id': id, 'tabindex': tabindex,
204   - 'ClsidCacheIndex': ClsidCacheIndex}
  204 + 'ClsidCacheIndex': ClsidCacheIndex, 'value': None}
205 205  
206 206 def consume_FormControl(stream):
207 207 # FormControl: [MS-OFORMS] 2.2.10.1
... ... @@ -294,10 +294,9 @@ def extract_OleFormVariables(ole_file, stream_dir):
294 294 data = ExtendedStream.open(ole_file, '/'.join(stream_dir + ['o']))
295 295 for var in variables:
296 296 if var['ClsidCacheIndex'] != 23:
297   - #raise OleFormParsingError('Unsupported stored type: {0}'.format(str(var['ClsidCacheIndex'])))
298 297 # TODO: use logging instead of print
299 298 print('ERROR: Unsupported stored type in user form: {0}'.format(str(var['ClsidCacheIndex'])))
300   - var['value'] = None
  299 + break
301 300 else:
302 301 var['value'] = consume_MorphDataControl(data)
303 302 return variables
... ...