After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760896 - gucharmap: Buffer overflow that appears already during compilation
gucharmap: Buffer overflow that appears already during compilation
Status: RESOLVED FIXED
Product: gucharmap
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gucharmap maintainers
gucharmap maintainers
Depends on:
Blocks:
 
 
Reported: 2016-01-20 17:33 UTC by Hanno Böck
Modified: 2016-09-19 20:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
address sanitizer stack trace / error message (3.35 KB, text/plain)
2016-01-20 17:33 UTC, Hanno Böck
Details
output of failing make (including some Glib warnings) (1.68 KB, text/plain)
2016-01-20 17:34 UTC, Hanno Böck
Details

Description Hanno Böck 2016-01-20 17:33:40 UTC
Created attachment 319450 [details]
address sanitizer stack trace / error message

I tried to compile gucharmap with Address Sanitizer (-fsanitize=address in CFLAGS) enabled. This uncovers a heap buffer overflow.

I'm not very familiar with the build system stuff there and have a bit trouble tracking down what's causing this, but I'll try to give as much information as I can.

According to the address sanitizer error message (attached) this happens in the function gucharmap_chartable_accessible_class_init() in gucharmap-chartable-accessible.c, line 547. That gets called by g_type_class_ref in libgobject, which itself gets called by a number of functions that only seem to exist in a temporary file tmp-introspectlZhRe8/Gucharmap-2.90.c (I haven't found an easy way to tell the build system to not delete that temp file after an error so I can analyze it...)

This is the code where this happens:
  accessible_class->connect_widget_destroyed = gucharmap_chartable_accessible_connect_widget_destroyed;

This indicates that accessible_class->connect_widget_destroyed is not within the bounds of the allocated object.

There is this error message which might indicate that something with the types is going wrong here:
(process:25843): GLib-GObject-WARNING **: invalid class cast from 'GucharmapChartableAccessible' to 'GtkAccessible'

This error appears in the git version, in 3.18.2 and 3.16.2. This all only happens with introspection enabled, if I disable it I don't see this error.
Comment 1 Hanno Böck 2016-01-20 17:34:49 UTC
Created attachment 319451 [details]
output of failing make (including some Glib warnings)
Comment 2 Christian Persch 2016-01-20 18:49:07 UTC
Iirc the problem is that a11y is different during gobject introspection run and during normal run (ie there's some sort of dummy accessible that doesn't derive from GtkAccessible, which means the class cast fails and thus the accessible_class pointer is NULL).
Comment 3 Christian Persch 2016-09-19 20:12:27 UTC
Fixed on master.