Skip to content

Commit 3f8e17c

Browse files
grnd-altkesselb
authored andcommitted
chore(mp3info): apply upstream patch for parsing on short frames
Signed-off-by: grnd-alt <github@belakkaf.net> Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent f5e230b commit 3f8e17c

File tree

5 files changed

+48
-1
lines changed

5 files changed

+48
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
From 186b99ac4a57d091e9414c0944524a9e098835f3 Mon Sep 17 00:00:00 2001
2+
From: grnd-alt <github@belakkaf.net>
3+
Date: Mon, 13 Oct 2025 12:18:37 +0200
4+
Subject: [PATCH] fix: break frame parsing on short frame
5+
6+
Signed-off-by: grnd-alt <github@belakkaf.net>
7+
---
8+
src/Mp3Info.php | 5 +++++
9+
1 file changed, 5 insertions(+)
10+
11+
diff --git a/src/Mp3Info.php b/src/Mp3Info.php
12+
index ccf97f4..24781d7 100644
13+
--- a/src/Mp3Info.php
14+
+++ b/src/Mp3Info.php
15+
@@ -584,6 +584,11 @@ protected function parseId3v23Body($fp, $lastByte) {
16+
$raw = fread($fp, 10);
17+
$frame_id = substr($raw, 0, 4);
18+
19+
+ if (strlen($raw) < 10) {
20+
+ fseek($fp, $lastByte);
21+
+ break;
22+
+ }
23+
+
24+
if ($frame_id == str_repeat(chr(0), 4)) {
25+
fseek($fp, $lastByte);
26+
break;

composer.patches.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"patches": {}
2+
"patches": {
3+
"wapmorgan/mp3info": {
4+
"Break frame parsing on invalid frame": ".patches/mp3info-break-frame-parsing.patch"
5+
}
6+
}
37
}

composer/installed.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6190,6 +6190,11 @@
61906190
"bin/mp3scan"
61916191
],
61926192
"type": "library",
6193+
"extra": {
6194+
"patches_applied": {
6195+
"Break frame parsing on invalid frame": ".patches/mp3info-break-frame-parsing.patch"
6196+
}
6197+
},
61936198
"installation-source": "dist",
61946199
"autoload": {
61956200
"psr-4": {

wapmorgan/mp3info/PATCHES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)
2+
Patches applied to this directory:
3+
4+
Break frame parsing on invalid frame
5+
Source: .patches/mp3info-break-frame-parsing.patch
6+
7+

wapmorgan/mp3info/src/Mp3Info.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,11 @@ protected function parseId3v23Body($fp, $lastByte) {
585585
$raw = fread($fp, 10);
586586
$frame_id = substr($raw, 0, 4);
587587

588+
if (strlen($raw) < 10) {
589+
fseek($fp, $lastByte);
590+
break;
591+
}
592+
588593
if ($frame_id == str_repeat(chr(0), 4)) {
589594
fseek($fp, $lastByte);
590595
break;

0 commit comments

Comments
 (0)