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 793512 - power: divide by zero on keyboard brightness request
power: divide by zero on keyboard brightness request
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: power
3.27.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2018-02-16 14:10 UTC by Yanko Kaneti
Modified: 2018-03-02 18:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
power: Fix divide by zero on keyboard Brightness property request (1.38 KB, patch)
2018-02-16 14:10 UTC, Yanko Kaneti
committed Details | Review
power: Add test for previous commit (1.60 KB, patch)
2018-03-02 18:07 UTC, Bastien Nocera
committed Details | Review

Description Yanko Kaneti 2018-02-16 14:10:42 UTC
Created attachment 368425 [details] [review]
power: Fix divide by zero on keyboard Brightness property request

gnome-settings-daemon-3.27.90-4.fc28.x86_64.rpm

               Stack trace of thread 1220:
                #0  0x000055c66637b6fc gsd_power_backlight_abs_to_percentage (gsd-power)
                #1  0x000055c66638112f handle_get_property_other (gsd-power)
                #2  0x00007f8581542f89 invoke_get_all_properties_in_idle_cb (libgio-2.0.so.0)
                #3  0x00007f8580f5109b g_idle_dispatch (libglib-2.0.so.0)
                #4  0x00007f8580f5477d g_main_dispatch (libglib-2.0.so.0)
                #5  0x00007f8580f54b48 g_main_context_iterate (libglib-2.0.so.0)
                #6  0x00007f8580f54e72 g_main_loop_run (libglib-2.0.so.0)
                #7  0x00007f8581d5a0a5 gtk_main (libgtk-3.so.0)
                #8  0x000055c66637adde main (gsd-power)
                #9  0x00007f857fec31bb __libc_start_main (libc.so.6)
                #10 0x000055c66637af0a _start (gsd-power)

gsd-power is build with G_DISABLE_CHECKS on Fedora so the failsaves in gsd_power_backlight_abs_to_percentage don't work for max_brighness = 0
Comment 1 Bastien Nocera 2018-03-02 18:07:23 UTC
Created attachment 369199 [details] [review]
power: Add test for previous commit

This just tries to access the keyboard brightness, which should crash
gsd-power without the fix.
Comment 2 Bastien Nocera 2018-03-02 18:09:00 UTC
Attachment 368425 [details] pushed as 36bc0a4 - power: Fix divide by zero on keyboard Brightness property request
Attachment 369199 [details] pushed as c42b68b - power: Add test for previous commit