Found an issue in busybox's fbsplash.c after revision e4fa7b7965fd574cff2a6a9b877522d613804a38

Kutter, Michael (Lawo AG) Michael.Kutter at lawo.de
Fri Jul 6 19:01:36 UTC 2012


Hello all,

I just stumbled over a little issue using fbsplash. I'm getting a strange progress bar layout and shortly afterwards a segfault whenever I write a percentage (different from 0) into my fbsplash pipe. The reason is quite simple. We're running into a signed/unsigned endless loop problem. Since revision

http://code.metager.de/source/xref/busybox/miscutils/fbsplash.c?r=e4fa7b7965fd574cff2a6a9b877522d613804a38

the type of the counter "i" in fb_drawprogressbar changed from int to unsigned. The typical refactoring issue in doing so is to consequently modify all reverse loops including zero and stopping when reaching -1 like

while (i >= 0)
   i--; 

As "i" is now unsigned, the condition will always be true and we're getting an endless loop. When doing calculations with pointers depending on the counter we're running into a segfault quite fast...

There are two possible fixes of course: either using int again for "i" or breaking the loop when "i" reaches zero. 

Best regards,
Michael


-- 
Dipl. Ing. Michael Kutter
Head of Software Division
Lawo AG
Am Oberwald 8, D-76437 Rastatt, Germany
Tel. +49 7222 1002 5740 
mailto:michael.kutter at lawo.de, www.lawo.de
-- 

Lawo AG, Registered Office: Rastatt, Amtsgericht Mannheim HRB 707330
CEO: Philipp Lawo / Chairman of the Supervisory Board: Christian Otto, Attorney at Law



More information about the busybox mailing list