Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Peter Ross authored on 2013/12/23 19:04:45... | ... |
@@ -153,6 +153,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int |
153 | 153 |
AVIOContext *pb; |
154 | 154 |
WtvFile *wf; |
155 | 155 |
uint8_t *buffer; |
156 |
+ int64_t size; |
|
156 | 157 |
|
157 | 158 |
if (seek_by_sector(s->pb, first_sector, 0) < 0) |
158 | 159 |
return NULL; |
... | ... |
@@ -205,7 +206,8 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int |
205 | 205 |
return NULL; |
206 | 206 |
} |
207 | 207 |
|
208 |
- if ((int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > avio_size(s->pb)) |
|
208 |
+ size = avio_size(s->pb); |
|
209 |
+ if (size >= 0 && (int64_t)wf->sectors[wf->nb_sectors - 1] << WTV_SECTOR_BITS > size) |
|
209 | 210 |
av_log(s, AV_LOG_WARNING, "truncated file\n"); |
210 | 211 |
|
211 | 212 |
/* check length */ |