Fixes: signed integer overflow: 10 * 1952737655 cannot be represented in type 'int' Fixes: PoC_avi_demux
Unified · Split
| @@ -1593,7 +1593,7 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o) · 1592 unmodified lines | ||
| 1593 | 1593 | { |
| 1594 | 1594 | AVFormatContext *oc = mux->fc; |
| 1595 | 1595 | InputStream *best_ist = NULL; |
| 1596 | − int best_score = 0; | |
| 1596 | + int64_t best_score = 0; | |
| 1597 | 1597 | int qcr; |
| 1598 | 1598 | |
| 1599 | 1599 | /* video: highest resolution */ |
| @@ -1604,16 +1604,16 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o) · 4 unmodified lines | ||
| 1604 | 1604 | for (int j = 0; j < nb_input_files; j++) { |
| 1605 | 1605 | InputFile *ifile = input_files[j]; |
| 1606 | 1606 | InputStream *file_best_ist = NULL; |
| 1607 | − int file_best_score = 0; | |
| 1607 | + int64_t file_best_score = 0; | |
| 1608 | 1608 | for (int i = 0; i < ifile->nb_streams; i++) { |
| 1609 | 1609 | InputStream *ist = ifile->streams[i]; |
| 1610 | − int score; | |
| 1610 | + int64_t score; | |
| 1611 | 1611 | |
| 1612 | 1612 | if (ist->user_set_discard == AVDISCARD_ALL || |
| 1613 | 1613 | ist->st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) |
| 1614 | 1614 | continue; |
| 1615 | 1615 | |
| 1616 | − score = ist->st->codecpar->width * ist->st->codecpar->height | |
| 1616 | + score = ist->st->codecpar->width * (int64_t)ist->st->codecpar->height | |
| 1617 | 1617 | + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS) |
| 1618 | 1618 | + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT); |
| 1619 | 1619 | if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) |