Giter Site home page Giter Site logo

Crash in g_utf8_validate about mpv-mpris HOT 7 CLOSED

hoyon avatar hoyon commented on May 24, 2024
Crash in g_utf8_validate

from mpv-mpris.

Comments (7)

hoyon avatar hoyon commented on May 24, 2024

Does your system have GLib >= 2.52? Because the code to ensure that non utf8 strings are properly handled depends on a function added in GLib 2.52, and is skipped in systems with an older GLib version.

from mpv-mpris.

lgbaldoni avatar lgbaldoni commented on May 24, 2024

Chiming in: I have GLib 2.54.3 and I'm experiencing the same problem.

from mpv-mpris.

szotsaki avatar szotsaki commented on May 24, 2024

Yes, I have 2.56.2.

from mpv-mpris.

hoyon avatar hoyon commented on May 24, 2024

Do you have a link to a radio stream or file I can use to test this issue with?

from mpv-mpris.

traycold avatar traycold commented on May 24, 2024

I also have same issue, here follows an example of the error and url of a radio stream causing it. Of course, it not always happens, just when the title of the song or author contains some "special" characters (in this radio is quite frequent, anyway, given the type of music -classical- and authors).

>mpv http://stream.srg-ssr.ch/m/rsc_it/aacp_96  
Playing: http://stream.srg-ssr.ch/m/rsc_it/aacp_96
 (+) Audio --aid=1 (aac 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch float
A: 00:00:07 / 00:00:15 (50%) Cache:  7s+152KB
File tags:
 icy-title: Leopold Antonin Kozeluch - Sinfonia in fa maggiore
A: 00:15:51 / 00:17:37 (89%) Cache: 106s+2MB
File tags:
 icy-title: Fr�d�ric Chopin - Valzer brillante in la bemolle maggiore op. 34 n. 1 

(process:3442): GLib-CRITICAL **: 14:53:32.327: g_variant_new_string: assertion 'g_utf8_validate (string, -1, NULL)' failed

from mpv-mpris.

hoyon avatar hoyon commented on May 24, 2024

I've had a look into the issue and it seems that, according to http://icecast.org/docs/icecast-2.4.1/config-file.html, many radio streams use latin1 encoding instead of utf-8 when they are not an ogg stream. Radio streams can specify their character encoding, but I'm not sure if that is actually done, and how I would get that information from mpv.

It may be possible to detect the encoding of the text and convert it accordingly, but I'm not sure how to reliably do that without introducing more bugs relating to the text conversion.

I am already calling g_utf8_make_valid but that seems to let the strings through without catching the fact that they are not valid utf-8.

from mpv-mpris.

hoyon avatar hoyon commented on May 24, 2024

Sorry this took so long. I've decided the best thing to do would be to call g_utf8_validate myself before passing it to glib and give a placeholder string if it isn't valid even after trying to fix it. I guess it's better than crashing.

from mpv-mpris.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.