Skip to content

Variable referenced before assignment + index out of range #26

@decalage2

Description

@decalage2

Originally reported by: Meni Farjon (Bitbucket: solebitlabs_meni_farjon, GitHub: Unknown)


Hi,
First of all thanks for the huge work.
I've encountered a variable reference error + an index out of range while using olefile.py.

Trace:

#!text
Traceback (most recent call last):
  File "/libs/olefile.py", line 2103, in getproperties
    s = b"****" + fp.read(i32(fp.read(4))-4)
  File "/libs/olefile.py", line 493, in i32
    return i8(c[o]) | (i8(c[o+1])<<8) | (i8(c[o+2])<<16) | (i8(c[o+3])<<24)
IndexError: index out of range

During handling of the above exception, another exception occurred:

#!text
Traceback (most recent call last):
  File "/ole2_compound/ole2_compound.py", line 45, in decode
    if is_encoded(data):
  File "/ole2_compound/ole2_compound.py", line 274, in is_encoded
    office_type, office_properties = detect_office_file_type(ole)
  File "/ole2_compound/ole2_compound.py", line 92, in detect_office_file_type
    properties = ole.getproperties(['\x05SummaryInformation'])
  File "/libs/olefile.py", line 2112, in getproperties
    self._raise_defect(DEFECT_INCORRECT, msg, type(exc))
UnboundLocalError: local variable 'type' referenced before assignment

Attached is the xls file causing the errors. (310445.xls)
Using python 3.2.
olefile version 0.42 2015-01-25

Thanks!


Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions