-
Notifications
You must be signed in to change notification settings - Fork 6
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
Arch triggers memory bug (in rsvg?) #92
Comments
Not sure if this is a bug in my code, or in librsvg==2:2.54.4-1 (Working version: 2.40.20-2ubuntu0.2 on amd4), but I can't see anything strange w the parameters to the call to rsvg_handle_new_from_data() from my code using pdb... |
How do I debug glass-renderer? Could you share a screenshot? It would help to know whether we see the same thing on Arch or not. Same version of librsvg here. |
Could you also share what packages are installed? |
So the debugging I did was to start the container with DOCKEROS=arch DOCKERCOMMAND=/bin/bash make run-in-docker Then when it starts to spew errors, I closed the Xephyr window, and had a look at the logfile called "log", and then did gdb build/env/bin/glass-renderer core You should also be able to do make GLASS_DEBUGGER=gdb run from inside the container, but it seems a bit broken at the moment. |
You might want to pull latest version (I fixed some of the gdb problems) |
Thank you! I will take a look. You should perhaps tag your commits with the corresponding issue numbers. Just add a comment with the issue number, such as |
Also (new version again): make GLASS_DEBUGGER=gdb GLASS_GHOSTS_OPTIONS=--no-restart-components run will make things a bit saner... |
What about having a |
Or just |
Hm, I can add that :) I've just been adding more and more environment variables that turn on/off individual functions for now, but some stuff is pretty obv you want together, like, why'd you want restarts of components that crash, if you're debugging them? That just makes your gdb session confusing :P |
Could even wrap this and run in docker, so you have debug in docker as one command |
@redhog still alive? :) |
Yep. Haven't done much on InfiniteGlass for a long time though :S |
Are you still using it as your daily driver? I would be delighted if you would have some time to spare and help to figure out what is holding me up with InfiniteGlass. It hasn't worked on my machine in a long time. |
I'm going on a interrail trip across Europe in a week, but I could definitely spend some time with you after that, but that's in August... |
Sounds excellent to me! I'd just like that you show me around, your workflow, answer a few questions and so on. I always have this feeling that I'm close enough to contribute but alas... My suspicion has always been that if I run it as my daily driver, then I will have time to figure it out. Or at least no choice. Hope you will enjoy your vacation. Looking forward to hearing from you! (Do you have a discord or something else that you use these days? Something with screen sharing) |
Following on this issue and issues #88 and #94. One thing you had suggested in the past is to set ssr-2023-10-19_20.23.49.mp4
|
Additional information — librsvg version 2.50.7-1 on Rocky Linux. |
I have been stress testing |
It seems that |
group.fl.svg and tv.fl.svg are causing the issue. The issue preventing splash mode is caused by image.fl.svg. Replacing them fixed the problem. There is a need to sanitize the SVGs on the fly or validate them beforehand. |
ghost.svg seems to be problematic as well. |
Loading and saving the SVG on https://jakearchibald.github.io/svgomg/ is working. Probably doable on Inkscape as well using clean up or optimize. |
- Some malformed SVG cause glass-renderer to core dump with `malloc(): memory corruption (fast)`. - Run using `./scripts/svg-sanitizer.sh`. - It currently skips fontawesome SVGs assuming they are valid. - All the SVGs have been updated.
Wow, so librsvg crashes if the data (svg file) is bad? Wow. |
Absolutely unexpected! How does GNOME even handle this? By the way, excellent documentation and information on the issue tracker. It was helpful to debug this. |
Doing due diligence here. The following program is actually not crashing from the faulty SVG files.
#include <cairo.h>
#include <librsvg/rsvg.h>
#include <glib.h>
#include <glib/gstdio.h>
int main(int argc, char **argv) {
if (argc != 2) {
g_printerr("Usage: %s <SVG file>\n", argv[0]);
return 1;
}
RsvgHandle *rsvg;
RsvgDimensionData dimensions;
cairo_surface_t *surface;
cairo_t *cr;
GError *error = NULL;
gchar *svg_data;
gsize length;
// Initialize librsvg
rsvg_init();
// Read SVG data from file
if (!g_file_get_contents(argv[1], &svg_data, &length, &error)) {
g_printerr("Error reading file: %s\n", error->message);
return 1;
}
// Load SVG from string data
rsvg = rsvg_handle_new_from_data((const guint8 *)svg_data, length, &error);
if (!rsvg) {
g_free(svg_data);
g_printerr("Error loading SVG data: %s\n", error->message);
return 1;
}
// Get SVG dimensions
rsvg_handle_get_dimensions(rsvg, &dimensions);
// Create cairo surface and context
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, dimensions.width, dimensions.height);
cr = cairo_create(surface);
// Render SVG onto the cairo context
rsvg_handle_render_cairo(rsvg, cr);
// Save the cairo surface to a PNG file
cairo_surface_write_to_png(surface, "output_from_file.png");
// Cleanup
cairo_destroy(cr);
cairo_surface_destroy(surface);
g_object_unref(rsvg);
g_free(svg_data);
// Shutdown librsvg
rsvg_term();
return 0;
} |
This just might have finally been solved, see ddd9e37 |
Please test, and it this fixes it on other distros as well, we can finally close this. |
glass-renderer core dumps after writing
malloc(): memory corruption (fast)
a few 100 times.
Traceback with pdb from core dump:
The text was updated successfully, but these errors were encountered: