Bug 246796

Summary: Stack overflow detected when running powertop with de_DE.UTF-8 locale
Product: [Fedora] Fedora Reporter: Till Maas <opensource>
Component: powertopAssignee: Adam Jackson <ajax>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 7CC: jwboyer
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.7-3.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-07-12 23:38:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Backtrace of the error in gdb with powertop-debuginfo installed on F7
none
uses strncpy instead of strcpy for writing into status_bar_slots none

Description Till Maas 2007-07-04 23:08:56 UTC
Description of problem:

When I start powertop with LC_ALL=de_DE.UTF-8, after 5 seconds it says that a
stack overflow has been detected:

The problem seems to be here:
#6  0x0804cf21 in pick_suggestion () at suggestions.c:122
#7  0x0804acfd in main () at powertop.c:649

Version-Release number of selected component (if applicable):
1.5-1.fc7

How reproducible:
always

Steps to Reproduce:
1. run: LC_ALL=de_DE.UTF-8 powertop
  
Actual results:
Program terminates with backtrace/stack overflow detection warning (output attached)

Expected results:
A useful screen as it appears with LC_ALL=C

Comment 1 Till Maas 2007-07-04 23:08:56 UTC
Created attachment 158557 [details]
Backtrace of the error in gdb with powertop-debuginfo installed on F7

Comment 2 Josh Boyer 2007-07-04 23:45:17 UTC
1.5 is two releases behind.  I'll look at bumping powertop in F-7 to version 1.7
as soon as I can.  We'll see if that fixes it.

Comment 3 Till Maas 2007-07-05 00:29:34 UTC
(In reply to comment #2)
> 1.5 is two releases behind.  I'll look at bumping powertop in F-7 to version 1.7
> as soon as I can.  We'll see if that fixes it.

I compiled the spec from devel with "make i386" for F-7 and on another machine
there is pretty much the same error, the backtrace only shows another line
number for powertop.c:

#6  0x0804d791 in pick_suggestion () at suggestions.c:122
#7  0x0804ad1d in main () at powertop.c:676


Comment 4 Till Maas 2007-07-05 00:54:17 UTC
Created attachment 158569 [details]
uses strncpy instead of strcpy for writing into status_bar_slots

This patch fixes at least my issue. The problem is, that just strcpy is used to
write into status_bar_slots[9], which is 40 characters long. The localized
messages are one character longer. The patch changes all instances of strcpy
into strncpy and also defines constans STATUS_BAR_SLOTSIZE and
STATUS_BAR_NR_SLOTS for usage in strncpy. But I guess the complete source needs
further inspection for similiar bugs. And maybe the SLOTSIZE can be made
bigger, because I guess that some messages may be even longer.

Comment 5 Till Maas 2007-07-05 01:10:59 UTC
I also sent the patch to power bughost org, but I do not know, whether or not
they accept my mail without being subsribed to the list.

Comment 6 Till Maas 2007-07-05 11:49:46 UTC
I also found some typos in the german translation, if you want, I add the strcpy
and the translation patch to the devel branch. But I would increase the
STATUS_BAR_SLOTSIZE first, maybe to 60 characters, because there are several
hints, that are longer than 40 characters and would not be displayed completely
otherwise.

Comment 7 Adam Jackson 2007-07-09 18:01:46 UTC
Added that patch to 1.7-3.fc8, it'll bubble back to F-7 in an update.

Thanks!

Comment 8 Fedora Update System 2007-07-10 06:41:46 UTC
powertop-1.7-3.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2007-07-12 23:38:51 UTC
powertop-1.7-3.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.