bug in write.id3v2

Locked
flaupretre
User
Posts:1
Joined:Thu Oct 20, 2011 3:13 pm
Are you a spambot?:no
bug in write.id3v2

Post by flaupretre » Thu Oct 20, 2011 3:24 pm

Calling preg_match at line 1887 in write.id3v3.php, using '#' as regexp delimiter, but another '#' is used in the pattern.

getid3 version: 1.9.1-20110810

Symptom : Warning: preg_match(): Unknown modifier '/' in <...>/write.id3v2.php on line 1887

Fix: Use a different delimiter char or escape the '#' in pattern with a '\'.

Patch :

Code: Select all

# diff -p write.id3v2.php.orig write.id3v2.php
*** write.id3v2.php.orig        Thu Oct 20 17:05:08 2011
--- write.id3v2.php     Thu Oct 20 17:05:15 2011
*************** class getid3_write_id3v2
*** 1884,1890 ****
                        return false;
                } elseif (!preg_match("#^[[:alnum:]/_\.@~-]*$#i", $parts['path'], $regs)) {
                        return false;
!               } elseif (!empty($parts['query']) && !preg_match("#^[[:alnum:]?&=+:;_()%#/,\.-]*$#i", $parts['query'], $regs)) {
                        return false;
                } else {
                        return true;
--- 1884,1890 ----
                        return false;
                } elseif (!preg_match("#^[[:alnum:]/_\.@~-]*$#i", $parts['path'], $regs)) {
                        return false;
!               } elseif (!empty($parts['query']) && !preg_match('#^[[:alnum:]?&=+:;_()%\#/,\.-]*$#i', $parts['query'], $regs)) {
                        return false;
                } else {
                        return true;

James Heinrich
getID3() v1 developer
Posts:1477
Joined:Fri May 04, 2001 4:00 pm
Are you a spambot?:no
Location:Northern Ontario, Canada
Contact:

Re: bug in write.id3v2

Post by James Heinrich » Tue Oct 25, 2011 8:59 pm

Bug confirmed, fix will be included in v1.9.2

Locked