History

fftools/ffmpeg_mux_init: Use 64bit for score computation in map_auto_video()

Fixes: signed integer overflow: 10 * 1952737655 cannot be represented in type 'int' Fixes: PoC_avi_demux

Michael Niedermayer committed 1 year ago

Commit 3cab0091 parent 3e05b891 file · +4 −4Browse files

Unified · Split

fftools/ffmpeg_mux_init.c+4−4
@@ -1593,7 +1593,7 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o) · 1592 unmodified lines
15931593 {
15941594 AVFormatContext *oc = mux->fc;
15951595 InputStream *best_ist = NULL;
1596− int best_score = 0;
1596+ int64_t best_score = 0;
15971597 int qcr;
15981598
15991599 /* video: highest resolution */
@@ -1604,16 +1604,16 @@ static int map_auto_video(Muxer *mux, const OptionsContext *o) · 4 unmodified lines
16041604 for (int j = 0; j < nb_input_files; j++) {
16051605 InputFile *ifile = input_files[j];
16061606 InputStream *file_best_ist = NULL;
1607− int file_best_score = 0;
1607+ int64_t file_best_score = 0;
16081608 for (int i = 0; i < ifile->nb_streams; i++) {
16091609 InputStream *ist = ifile->streams[i];
1610− int score;
1610+ int64_t score;
16111611
16121612 if (ist->user_set_discard == AVDISCARD_ALL ||
16131613 ist->st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
16141614 continue;
16151615
1616− score = ist->st->codecpar->width * ist->st->codecpar->height
1616+ score = ist->st->codecpar->width * (int64_t)ist->st->codecpar->height
16171617 + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
16181618 + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
16191619 if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t