[PATCH] Don't make amaroK crash

Scott Wheeler wheeler at kde.org
Sat Aug 7 15:26:05 CEST 2004


On Saturday 07 August 2004 9:27, ismail donmez wrote:
> Hi all,
> 
> I was getting some crashes from amaroK and noticed that it was a problem in 
> Taglib. I was getting :
> 
> terminate called after throwing an instance of 'std::length_error'
> what():  basic_string::resize
> 
> Attached patch fixes the issue for me. Can you review and apply to cvs?

Well, I'm pretty sure it's not correct for the general case.

Looking at it I'm guessing that the issue is probably that when it gets called 
with an empty string that newSize is actually negative.  Can you see if you 
can reproduce it with this?

-    int newSize = target - targetBuffer - 1;
+    int newSize = target != targetBuffer ? (target - targetBuffer - 1) : 0;

-Scott


More information about the taglib-devel mailing list