mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-07 22:06:38 +08:00
fix: harden playback and security edge cases
This commit is contained in:
@@ -38,9 +38,9 @@ func EvaluateFFmpegSecurity(versionLine string) FFmpegSecurityStatus {
|
||||
FixedVersion: ffmpegPixelSmashFixedVersion,
|
||||
ParsedVersion: fmt.Sprintf("%d.%d.%d", major, minor, patch),
|
||||
}
|
||||
if major == 8 && minor == 1 && patch < 2 {
|
||||
if major == 8 && ffmpegVersionLess(major, minor, patch, 8, 1, 2) {
|
||||
status.Status = "vulnerable"
|
||||
status.Message = "当前 FFmpeg 8.1.x 版本低于 8.1.2,可能受 PixelSmash 解码漏洞影响;请升级 ffmpeg/ffprobe"
|
||||
status.Message = "当前 FFmpeg 8.x 版本低于 8.1.2,可能受 PixelSmash 解码漏洞影响;请升级 ffmpeg/ffprobe"
|
||||
return status
|
||||
}
|
||||
if major < 8 {
|
||||
@@ -50,6 +50,16 @@ func EvaluateFFmpegSecurity(versionLine string) FFmpegSecurityStatus {
|
||||
return status
|
||||
}
|
||||
|
||||
func ffmpegVersionLess(major, minor, patch, fixedMajor, fixedMinor, fixedPatch int) bool {
|
||||
if major != fixedMajor {
|
||||
return major < fixedMajor
|
||||
}
|
||||
if minor != fixedMinor {
|
||||
return minor < fixedMinor
|
||||
}
|
||||
return patch < fixedPatch
|
||||
}
|
||||
|
||||
func parseFFmpegVersionLine(versionLine string) (major, minor, patch int, ok bool) {
|
||||
match := ffmpegVersionRE.FindStringSubmatch(strings.TrimSpace(versionLine))
|
||||
if len(match) < 3 {
|
||||
|
||||
Reference in New Issue
Block a user