File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ def unpack_uint(self):
8989 i = self .pos
9090 self .pos = j = i + 4
9191 data = self .buf [i :j ]
92+ if len (data ) < 4 :
93+ raise EOFError
9294 x = long (ord (data [0 ]))<< 24 | ord (data [1 ])<< 16 | \
9395 ord (data [2 ])<< 8 | ord (data [3 ])
9496 # Return a Python long only if the value is not representable
@@ -99,7 +101,10 @@ def unpack_uint(self):
99101 def unpack_uint (self ):
100102 i = self .pos
101103 self .pos = j = i + 4
102- return struct .unpack ('l' , self .buf [i :j ])
104+ data = self .buf [i :j ]
105+ if len (data ) < 4 :
106+ raise EOFError
107+ return struct .unpack ('l' , data )
103108
104109 def unpack_int (self ):
105110 x = self .unpack_uint ()
@@ -126,7 +131,7 @@ def unpack_fstring(self, n):
126131 i = self .pos
127132 j = i + (n + 3 )/ 4 * 4
128133 if j > len (self .buf ):
129- raise RuntimeError , 'buffer overrun'
134+ raise EOFError
130135 self .pos = j
131136 return self .buf [i :i + n ]
132137
You can’t perform that action at this time.
0 commit comments