[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Found an issue in busybox's fbsplash.c after revision e4fa7b7965fd574cff2a6a9b877522d613804a38
From:       "Kutter, Michael (Lawo AG)" <Michael.Kutter () lawo ! de>
Date:       2012-07-06 19:01:36
Message-ID: D7B1B5F4F3F27A4CB073BF422331203F25B3F72C9D () Exchange1 ! lawo ! de
[Download RAW message or body]

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@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

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic