Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taglib segfaults - Null String #296

Merged
merged 4 commits into from
Aug 6, 2014
Merged

Conversation

cardinot
Copy link
Contributor

Recently I faced up to some crashes due to metadata extraction... mainly when I'm trying to read a lot of embedded_covers at the same time. I realized that Mixxx is getting the info directly from the tag and trying to convert to QString and it was also the cause of the crashes.

Taglib strings can be NULL and using it could cause some segfaults, so in this case it will return a QString()
cardinot referenced this pull request in cardinot/mixxx Jul 22, 2014
- Try converting a TString from a metadata directly to QString can produce segfaults.
- We must check if it is valid before convert it.
@daschuer
Copy link
Member

Nice pick! LGTM Thank you!

@@ -223,6 +223,13 @@ void SoundSource::setKey(QString key){
m_sKey = key;
}

QString SoundSource::toQString(TagLib::String tstring) const {
if (tstring != TagLib::String::null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

total nitpick: can you say if (tstring == null) { return QString() } since that's the special case? I just like the look of it more that way :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean define TagLib::String::null as NULL ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this

if (tstring == TagLib::String::null) {
    return QString();
}
return TStringToQString(tstring);

I don't know if this is in the coding guidelines but usually in mixxx we exit function early only when an error occurs. The normal everything went ok exist is always at the end. In this case tstring being null is the error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!
Thanks =D

@kain88-de:
I don't know if this is in the coding guidelines but usually in mixxx we exit function early only when an error occurs. The normal everything went ok exist is always at the end. In this case tstring being null is the error
@@ -223,6 +223,13 @@ void SoundSource::setKey(QString key){
m_sKey = key;
}

QString SoundSource::toQString(TagLib::String tstring) const {
if (tstring == TagLib::String::null) {
return QString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space between return and QString

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ops, sorry...
done! =D

@daschuer
Copy link
Member

daschuer commented Aug 3, 2014

@ywwg @cardinot: Is it ready for merge?

@kain88-de
Copy link
Member

@daschuer keep in mind this will break the windows build until we update taglib

@kain88-de
Copy link
Member

@daschuer merging this will update the min required taglib version. Ubuntu 12.04 uses 1.7.1 a minor above the version we use in the windows build.

@cardinot what is the min required taglib version for your changes to work?

I don't have any problems merging this and saying that we don't support the old stable of ubuntu anymore.

@cardinot
Copy link
Contributor Author

cardinot commented Aug 6, 2014

@cardinot what is the min required taglib version for your changes to work?

Version 1.8.

@daschuer
Copy link
Member

daschuer commented Aug 6, 2014

Why does this patch not work with TagLib 1.7?
It would be really nice to find a workaround that let use build with Ubuntu Precise.

@cardinot
Copy link
Contributor Author

cardinot commented Aug 6, 2014

Why does this patch not work with TagLib 1.7?
It would be really nice to find a workaround that let use build with Ubuntu Precise.

Because 1.7 does not have a method with the operator !=...
Another important point is that many bugs that was leading to crashes were fixed in the last versions (1.8 and 1.9). So it means that if we force users to use newer taglib versions we would be avoiding some other crashes as well...

@cardinot
Copy link
Contributor Author

cardinot commented Aug 6, 2014

However, the version 1.7 has the operator== and I could use it to let it work with 1.7... ?

@kain88-de
Copy link
Member

You are already using ==. Did you test this branch with an older version of taglib yet?

I can test it on windows sometime next week again. If it builds I will merge it

@cardinot
Copy link
Contributor Author

cardinot commented Aug 6, 2014

damn! I had forgotten that I had changed it already... sorry! =(
Anyway... yeah it should work with the prebuild package that we have for windows + taglib 1.7
I will check it on Win7 today...

@cardinot
Copy link
Contributor Author

cardinot commented Aug 6, 2014

Yeah, it works on Windows 7 (with the prebuild package)!

@kain88-de
Copy link
Member

awesome, thanks

kain88-de added a commit that referenced this pull request Aug 6, 2014
Taglib segfaults - Null String
@kain88-de kain88-de merged commit e9679ac into mixxxdj:master Aug 6, 2014
@ywwg
Copy link
Member

ywwg commented Aug 12, 2014

thanks for picking this up!

m0dB pushed a commit to m0dB/mixxx that referenced this pull request Jan 21, 2024
Add Download links to the beta version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants