TagLib::String stripWhiteSpace crashes?

Vitali Lovich vlovich at gmail.com
Thu Oct 12 21:51:46 CEST 2006


I was just starting out with TagLib, and when String represents a blank 
string (i.e. 5 spaces), a call to stripWhiteSpace will crash.  It seems 
that the first conditional isn't written quite correctly - shouldn't the 
begin != end check be the first statement?  With that change made, it no 
longer crashes on blank strings.

Here's the stripping conditional that doesn't crash and seems to work.  
I've never used patch.

while(begin != end && (*begin == '\t' || *begin == '\n' ||
      *begin == '\f' || *begin == '\r' || *begin == ' '))
  {
    ++begin;
  }


More information about the taglib-devel mailing list