Integer Overflow of Allocation Size at dtd_preparse.c:1227 |
No properties have been set. edit properties |
Jump to warning location ↓ | warning details... |
| |
yy_get_next_buffer (/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dtd_preparse.c)![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1162 | static int yy_get_next_buffer (void) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1163 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1164 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1165 | register char *source = (yytext_ptr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1166 | register int number_to_move, i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1167 | int ret_val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1168 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1169 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1170 | YY_FATAL_ERROR( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1171 | "fatal flex scanner internal error--end of buffer missed" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1172 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1173 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1174 | { /* Don't try to fill the buffer, so this is an EOF. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1175 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1176 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1177 | /* We matched a single character, the EOB, so | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1178 | * treat this as a final EOF. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1179 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1180 | return EOB_ACT_END_OF_FILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1181 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1182 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1183 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1184 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1185 | /* We matched some text prior to the EOB, first | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1186 | * process it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1187 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1188 | return EOB_ACT_LAST_MATCH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1189 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1190 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1191 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1192 | /* Try to read more data. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1193 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1194 | /* First move last chars to start of buffer. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1195 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1196 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1197 | for ( i = 0; i < number_to_move; ++i ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1198 | *(dest++) = *(source++); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1199 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1200 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1201 | /* don't do the read, it's not guaranteed to return an EOF, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1202 | * just force an EOF | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1203 | */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1204 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1205 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1206 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1207 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1208 | int num_to_read = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1209 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1210 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1211 | while ( num_to_read <= 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1212 | { /* Not enough room in the buffer - grow it. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1213 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1214 | /* just a shorter name for the current buffer */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1215 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1216 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1217 | int yy_c_buf_p_offset = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1218 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1219 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1220 | if ( b->yy_is_our_buffer ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1221 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1222 | int new_size = b->yy_buf_size * 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1223 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1224 | if ( new_size <= 0 ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1225 | b->yy_buf_size += b->yy_buf_size / 8; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1226 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1227 | b->yy_buf_size *= 2;
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1228 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1229 | b->yy_ch_buf = (char *) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1230 | /* Include room in for 2 EOB chars. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1231 | [+] | Dtd_PreParse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1232 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1233 | else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1234 | /* Can't grow it, we don't own it. */ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1235 | b->yy_ch_buf = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1236 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1237 | if ( ! b->yy_ch_buf ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1238 | YY_FATAL_ERROR( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1239 | "fatal error - scanner input buffer overflow" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1240 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1241 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1242 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1243 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1244 | number_to_move - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |