TagLib 1.5 segfaults on one file

Scott Wheeler wheeler at kde.org
Sun Jan 11 00:17:58 CET 2009


On Jan 10, 2009, at 11:58 PM, Vidar Wahlberg wrote:

> On Sat, Jan 10, 2009 at 11:23:51PM +0100, Scott Wheeler wrote:
>> Here's the diff I checked in -- this should do the trick, no?
>>
>> --- apeitem.cpp	(revision 892976)
>> +++ apeitem.cpp	(working copy)
>> @@ -164,7 +164,7 @@
>>      case Binary:
>>        if(d->text.isEmpty())
>             ^^^^^^^^^^^^^^^^^
>>          return true;
>> -      if(d->text.size() == 1 && d->text.front().isEmpty())
>> +      if(d->text.isEmpty() || (d->text.size() == 1 && d- 
>> >text.front().isEmpty()))
>            ^^^^^^^^^^^^^^^^^
>>          return true;
>>        return false;
>>      case Locator:
>
> I don't think this will make any difference, as this will as far as I
> can tell only check twice if d->text is empty (and in both cases  
> return
> "true").

Erm, yeah.  Reverted.

> However, "if(d->type == Text)" instead of "if(d->type !=  
> Item::Binary)"
> on line 209 in apeitem.cpp prevents it from segfaulting as the type
> apparently is neither "Text" nor "Item::Binary".

Which is the way that it is in current SVN.

> I don't know if you're
> guaranteed that "d->text.begin()" never is "d->text.end()" if the type
> is "Text", though. If this is guaranteed, then the check I added is  
> not
> necessary.

Yes, it is, since the line quoted above checks isEmpty().  If the list  
is not empty then begin != end.

-Scott




More information about the taglib-devel mailing list