Add hash check for ffmpeg/ffprobe

This commit is contained in:
niksedk 2023-11-17 23:17:11 +01:00
parent e2d9bc6104
commit e601824ccc
2 changed files with 16 additions and 1 deletions

View File

@ -48,6 +48,7 @@
* Update Purfview's Faster Whisper to r160.6 (large v3) - thx Purfview
* Update Whisper CPP to v1.5.0
* Update OpenAI Whisper to include large v3 model
* Update FFmpeg/FFprobe to version 6.1 (from 6.0)
* FIXED:
* Fix for paste in waveform - thx Ruong
* Fix remember text box settings (bold/size) - thx Siamak

View File

@ -3,6 +3,7 @@ using Nikse.SubtitleEdit.Core.Http;
using Nikse.SubtitleEdit.Logic;
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox;
@ -99,7 +100,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void CompleteDownload(Stream downloadStream)
private void CompleteDownload(MemoryStream downloadStream)
{
if (downloadStream.Length == 0)
{
@ -112,6 +113,19 @@ namespace Nikse.SubtitleEdit.Forms
Directory.CreateDirectory(folder);
}
var sha512Hashes = new[]
{
"08d1a88a6293ad9c66de2f11a029b648bafe7f2a0ebaca6bb863f11e7d80967f6804b8c2b86c2d8381a441857fd7fc52f2a9e95b340295e1b16ed124c6f776f3", // ffmpeg 6.1
"d2ee1d3bfa6cfb8c7563cfb8cd641962e7274149458630191a69b689e9c0288608885f51c39f578008e68856ee71bc66a82ed4b3cba2f1411aec2b4da991b974", // ffprobe 6.1
};
var hash = Utilities.GetSha512Hash(downloadStream.ToArray());
if (!sha512Hashes.Contains(hash))
{
MessageBox.Show("ffmpeg SHA 512 hash does not match - download aborted!"); ;
DialogResult = DialogResult.Cancel;
return;
}
downloadStream.Position = 0;
using (var zip = ZipExtractor.Open(downloadStream))
{