@@ -90,9 +90,9 @@ cdef class Message:
9090
9191 cdef int _process_error_info(self , ReadBuffer buf) except - 1 :
9292 cdef:
93+ uint32_t num_bytes, i, offset, num_offsets
9394 _OracleErrorInfo info = self .error_info
94- uint16_t num_entries, error_code
95- uint32_t num_bytes, i, offset
95+ uint16_t temp16, num_errors, error_code
9696 uint8_t first_byte
9797 int16_t error_pos
9898 str error_msg
@@ -122,11 +122,11 @@ cdef class Message:
122122 self .processed_error = True
123123
124124 # batch error codes
125- buf.read_ub2(& num_entries) # batch error codes array
126- if num_entries > 0 :
125+ buf.read_ub2(& num_errors) # batch error codes array
126+ if num_errors > 0 :
127127 info.batcherrors = []
128128 buf.read_ub1(& first_byte)
129- for i in range (num_entries ):
129+ for i in range (num_errors ):
130130 if first_byte == TNS_LONG_LENGTH_INDICATOR:
131131 buf.skip_ub4() # chunk length ignored
132132 buf.read_ub2(& error_code)
@@ -135,22 +135,25 @@ cdef class Message:
135135 buf.skip_raw_bytes(1 ) # ignore end marker
136136
137137 # batch error offsets
138- buf.read_ub2(& num_entries) # batch error row offset array
139- if num_entries > 0 :
138+ buf.read_ub4(& num_offsets) # batch error row offset array
139+ if num_offsets > 0 :
140+ if num_offsets > 65535 :
141+ errors._raise_err(errors.ERR_TOO_MANY_BATCH_ERRORS)
140142 buf.read_ub1(& first_byte)
141- for i in range (num_entries ):
143+ for i in range (num_offsets ):
142144 if first_byte == TNS_LONG_LENGTH_INDICATOR:
143145 buf.skip_ub4() # chunk length ignored
144146 buf.read_ub4(& offset)
145- info.batcherrors[i].offset = offset
147+ if i < num_errors:
148+ info.batcherrors[i].offset = offset
146149 if first_byte == TNS_LONG_LENGTH_INDICATOR:
147150 buf.skip_raw_bytes(1 ) # ignore end marker
148151
149152 # batch error messages
150- buf.read_ub2(& num_entries) # batch error messages array
151- if num_entries > 0 :
153+ buf.read_ub2(& temp16) # batch error messages array
154+ if temp16 > 0 :
152155 buf.skip_raw_bytes(1 ) # ignore packed size
153- for i in range (num_entries ):
156+ for i in range (temp16 ):
154157 buf.skip_ub2() # skip chunk length
155158 info.batcherrors[i].message = \
156159 buf.read_str(TNS_CS_IMPLICIT).rstrip()
0 commit comments