f7cloud_client/3rdparty/.patches/mp3info-fix-incorrect-lookup-for-mpeg-header.patch

34 lines
1.0 KiB
Diff

From 37365fd60dd3f4a637a887376b32f4d5e05726ce Mon Sep 17 00:00:00 2001
From: wapmorgan <wapmorgan@gmail.com>
Date: Sat, 28 Jun 2025 03:34:24 +0300
Subject: [PATCH] #30 Fix incorrect lookup for mpeg header. Previously it skips
1 extra byte every jump that leads to 50/50% chance to find mpeg header
---
bin/mp3scan | 2 +-
src/Mp3Info.php | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/bin/mp3scan b/bin/mp3scan
index 8f3e28c..6352cc5 100755
--- a/bin/mp3scan
+++ b/bin/mp3scan
@@ -1,4 +1,4 @@
-#!/usr/bin/php
+#!/usr/bin/env php
<?php
use wapmorgan\Mp3Info\Mp3Info;
diff --git a/src/Mp3Info.php b/src/Mp3Info.php
index 17e4074..ccf97f4 100644
--- a/src/Mp3Info.php
+++ b/src/Mp3Info.php
@@ -363,7 +363,6 @@ private function readMpegFrame($fp) {
break;
}
}
- fseek($fp, 1, SEEK_CUR);
} while (ftell($fp) <= $header_seek_pos);
if (!isset($header_bytes) || $header_bytes[0] !== 0xFF || (($header_bytes[1] >> 5) & 0b111) != 0b111) {