tinycc-devel
[Top][All Lists]
Advanced

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

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


From: Diego Bauche Madero
Subject: Re: BUGFIX: [Tinycc-devel] Segmentation fault in tccelf.c:2189, strcmp
Date: Sat, 29 Oct 2005 03:06:41 -0400
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

Now that i look at the patch again, seems like i commited an error, sorry.
The patch must not do the goto the_end, but a break, otherwise it will
just go on without loading anything. Apparently the if statement is true
on every single shared library, so, here's the working patch:

--- tinycc-orig/tccelf.c        2005-10-27 02:43:35.000000000 -0400
+++ tinycc/tccelf.c     2005-10-27 02:55:19.000000000 -0400
@@ -2184,6 +2184,8 @@ static int tcc_load_dll(TCCState *s1, in
         switch(dt->d_tag) {
         case DT_NEEDED:
             name = dynstr + dt->d_un.d_val;
+            if ((Elf32_Dyn *)name > dynamic + (nb_dts * sizeof(Elf32_Dyn)))
+                break;
             for(i = 0; i < s1->nb_loaded_dlls; i++) {
                 dllref = s1->loaded_dlls[i];
                 if (!strcmp(name, dllref->name))



Cheers
- Diego Bauche Madero

Evan Langlois wrote:

>On Thu, 2005-10-27 at 03:06 -0400, Diego Bauche Madero wrote:
>
>  
>
>>--- tinycc-orig/tccelf.c        2005-10-27 02:43:35.000000000 -0400
>>+++ tinycc/tccelf.c     2005-10-27 02:55:19.000000000 -0400
>>@@ -2184,6 +2184,8 @@ static int tcc_load_dll(TCCState *s1, in
>>         switch(dt->d_tag) {
>>         case DT_NEEDED:
>>             name = dynstr + dt->d_un.d_val;
>>+            if ((Elf32_Dyn *)name > dynamic + (nb_dts * sizeof(Elf32_Dyn)))
>>+                goto the_end;
>>             for(i = 0; i < s1->nb_loaded_dlls; i++) {
>>                 dllref = s1->loaded_dlls[i];
>>                 if (!strcmp(name, dllref->name))
>>
>>    
>>
>
>WOW - Excellent work.  I can't honestly say if the fault is TCC or GCC,
>or if they just don't like each other mutually, but a patch that makes
>TCC work both ways is excellent news.
>
>Now I'm wondering if that patch will make tcc work with boehm's GC.  Its
>entirely possible that my previous problems with that library were due
>to it being compiled with GCC, and considering that a GC will hit most
>all of RAM looking for roots, it is very likely to hit such a bug.
>
>Hopefully it will get comitted to CVS.
>
>
>
>
>
>_______________________________________________
>Tinycc-devel mailing list
>address@hidden
>http://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>
>
>  
>




reply via email to

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