Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,605
    • Issues 1,605
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 222
    • Merge requests 222
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • gtkgtk
  • Issues
  • #4140
Closed
Open
Issue created Jul 31, 2021 by Elliott Sales de Andrade@QuLogicContributor

`gtk_icon_helper_paintable_get_current_image` is broken?

gtk_icon_helper_paintable_get_current_image calls itself on self->paintable, recursively. Therefore, the only way to exit this call is if self->paintable == NULL. Which means, it never returns an image.

static GdkPaintable *
gtk_icon_helper_paintable_get_current_image (GdkPaintable *paintable)
{
  GtkIconHelper *self = GTK_ICON_HELPER (paintable);
    
  gtk_icon_helper_ensure_paintable (self, FALSE);
  if (self->paintable == NULL)
    return NULL;
  
  return gtk_icon_helper_paintable_get_current_image (self->paintable);
}

Additionally, self->paintable is either a GdkPaintable supplied directly by the user, or a GtkIconPaintable, neither of which are derived from GtkIconHelper, so the second call is going to pick out random memory, and possibly crash.

Apparently, this is fine, because only GtkCellRendererPixbuf and GtkImage use GtkIconHelper, and they only call gdk_paintable_snapshot on it. And since it's otherwise private, there's probably no other way to trigger it. So it looks odd, but is probably benign.

Assignee
Assign to
Time tracking