tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Segmentation fault in tccelf.c:2189, strcmp - bugfix,


From: grischka
Subject: Re: [Tinycc-devel] Segmentation fault in tccelf.c:2189, strcmp - bugfix, i think
Date: Sun, 30 Oct 2005 22:33:01 +0100

> for(i = 0, dt = dynamic; i < nb_dts; i++, dt++) {
>       ...
>       name = dynstr + dt->d_un.d_val;
> +    if ((Elf32_Dyn *)name > dynamic + (nb_dts * sizeof(Elf32_Dyn)))
> +        break;

Hm, looks more like the strong sort of medicine.... 
Guess I would try this pill first:
http://lists.gnu.org/archive/html/tinycc-devel/2005-06/msg00026.html

--- grischka

Btw, upper array boundary is just: "pArray + nElements", also
compare of pointers into different memory regions is generally 
not useful (pointer into dynstr > pointer into dynamic). Also the 
end of the array is already outside, so, if at all, it would be >=, 
not >  

What you probably meant was:
    for(i = 0, dt = dynamic; i < nb_dts; i++, dt++) {
+        if (dt >= dynamic + nb_dts)
+            break;

which of course is logically redundant, as long as 'i' wasn't changed 
unexpectedly further down.

However, it probably happens more often than you might think, that bugs
are fixed by just some more bugs being added. As such, a bug in the right
place can make many users happy ;)










reply via email to

[Prev in Thread] Current Thread [Next in Thread]