Преглед изворни кода

UI: Set remux entry state before adding to queue

When adding to the queue, this triggers rowCountChanged which then
calls canClearFinished, reading undefined memory for state if this is
not set. The correct state is set immediately after by checkInputPath.

Detected by UBSan.
Richard Stanway пре 2 година
родитељ
комит
1f278bb18b
1 измењених фајлова са 2 додато и 0 уклоњено
  1. 2 0
      UI/window-remux.cpp

+ 2 - 0
UI/window-remux.cpp

@@ -367,6 +367,7 @@ bool RemuxQueueModel::setData(const QModelIndex &index, const QVariant &value,
 				for (QString path : pathList) {
 				for (QString path : pathList) {
 					RemuxQueueEntry entry;
 					RemuxQueueEntry entry;
 					entry.sourcePath = path;
 					entry.sourcePath = path;
+					entry.state = RemuxEntryState::Empty;
 
 
 					queue.insert(row, entry);
 					queue.insert(row, entry);
 					row++;
 					row++;
@@ -386,6 +387,7 @@ bool RemuxQueueModel::setData(const QModelIndex &index, const QVariant &value,
 		if (!path.isEmpty()) {
 		if (!path.isEmpty()) {
 			RemuxQueueEntry entry;
 			RemuxQueueEntry entry;
 			entry.sourcePath = path;
 			entry.sourcePath = path;
+			entry.state = RemuxEntryState::Empty;
 
 
 			beginInsertRows(QModelIndex(), queue.length() + 1,
 			beginInsertRows(QModelIndex(), queue.length() + 1,
 					queue.length() + 1);
 					queue.length() + 1);