| 1198 | } |
| 1199 | |
| 1200 | static int ivr_read_header(AVFormatContext *s) |
| 1201 | { |
| 1202 | unsigned tag, type, len, tlen, value; |
| 1203 | int i, j, n, count, nb_streams = 0, ret; |
| 1204 | uint8_t key[256], val[256]; |
| 1205 | AVIOContext *pb = s->pb; |
| 1206 | AVStream *st; |
| 1207 | int64_t pos, offset=0, temp; |
| 1208 | |
| 1209 | pos = avio_tell(pb); |
| 1210 | tag = avio_rl32(pb); |
| 1211 | if (tag == MKTAG('.','R','1','M')) { |
| 1212 | if (avio_rb16(pb) != 1) |
| 1213 | return AVERROR_INVALIDDATA; |
| 1214 | if (avio_r8(pb) != 1) |
| 1215 | return AVERROR_INVALIDDATA; |
| 1216 | len = avio_rb32(pb); |
| 1217 | avio_skip(pb, len); |
| 1218 | avio_skip(pb, 5); |
| 1219 | temp = avio_rb64(pb); |
| 1220 | while (!avio_feof(pb) && temp) { |
| 1221 | offset = temp; |
| 1222 | temp = avio_rb64(pb); |
| 1223 | } |
| 1224 | if (offset <= 0) |
| 1225 | return AVERROR_INVALIDDATA; |
| 1226 | avio_skip(pb, offset - avio_tell(pb)); |
| 1227 | if (avio_r8(pb) != 1) |
| 1228 | return AVERROR_INVALIDDATA; |
| 1229 | len = avio_rb32(pb); |
| 1230 | avio_skip(pb, len); |
| 1231 | if (avio_r8(pb) != 2) |
| 1232 | return AVERROR_INVALIDDATA; |
| 1233 | avio_skip(pb, 16); |
| 1234 | pos = avio_tell(pb); |
| 1235 | tag = avio_rl32(pb); |
| 1236 | } |
| 1237 | |
| 1238 | if (tag != MKTAG('.','R','E','C')) |
| 1239 | return AVERROR_INVALIDDATA; |
| 1240 | |
| 1241 | if (avio_r8(pb) != 0) |
| 1242 | return AVERROR_INVALIDDATA; |
| 1243 | count = avio_rb32(pb); |
| 1244 | for (i = 0; i < count; i++) { |
| 1245 | if (avio_feof(pb)) |
| 1246 | return AVERROR_INVALIDDATA; |
| 1247 | |
| 1248 | type = avio_r8(pb); |
| 1249 | tlen = avio_rb32(pb); |
| 1250 | avio_get_str(pb, tlen, key, sizeof(key)); |
| 1251 | len = avio_rb32(pb); |
| 1252 | if (type == 5) { |
| 1253 | avio_get_str(pb, len, val, sizeof(val)); |
| 1254 | av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val); |
| 1255 | } else if (type == 4) { |
| 1256 | av_log(s, AV_LOG_DEBUG, "%s = '0x", key); |
| 1257 | for (j = 0; j < len; j++) { |
nothing calls this directly
no test coverage detected