View Single Post
Old 21st April 2014, 21:03   #315
Forum King
thinktink's Avatar
Join Date: May 2009
Location: On the streets of Kings County, CA.
Posts: 2,972
Send a message via Skype™ to thinktink
Just as a shot in the dark to try to replicate the reported crash issues with opus files in the media library I created a short opus file and copy/pasta'd a short Chinese text sampler (complete with actual Chinese characters.) When I tried to import it into the library, it crashed. No error report or anything.

What I discovered was the difference between what the Winamp the core considers the length of a null-terminated string and what the Winamp ML expects.

When Winamp core reads the metadata, it tells the plugin "I can only hold 512 characters" in the "destlen" field. Here, it does not count the null terminator. If the metadata is longer than 512 characters then I chop it to 512 characters with dest[destlen]==0 and wcscpy it out so that I copy a total of 513 characters which includes the null terminator. No crash. If I go larger, el-crash-o of course.

Now when the ML asks for metadata, it says "I can only hold 1024 characters" in the "destlen" field. Here, IT DOES count the null terminator. If I chop it 1024 with dest[destlen]==0 then Winamp crashes when the function call returns.

So now I have to Chop(String,destlen-1) for all metadata calls. This means Winamp core will never get 512 characters, only 511, but now ML doesn't crash doing it this way.

I'll publish an update ASAP.
thinktink is offline   Reply With Quote