gnu-arch-users
[Top][All Lists]
Advanced

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

patch for tla--devo--1.3.2 (was Re: [Gnu-arch-users] [MERGE-REQUEST]: se


From: Matthew Dempsky
Subject: patch for tla--devo--1.3.2 (was Re: [Gnu-arch-users] [MERGE-REQUEST]: segfault using variable length argument list of rel_add_records())
Date: Thu, 07 Apr 2005 23:46:36 -0500

Since Wolfgang's changeset doesn't apply cleanly against the latest tla
1.3.2 branch, I've committed a changeset of my own based on his to
address@hidden/tla--use-nil-records--1.3.2--patch-1.

On Wed, 2005-04-06 at 10:48 +0200, Wolfgang Treutterer E1 wrote:
> As a new user I wanted to try out GNU Arch on my Solaris 2.8 workstation
> (gcc 3.3.2) but soon got stuck with the following problem:
> 
> After downloading configuring and compiling tla-1.3.1fix1 I encountered
> a segmentation fault running "make test". It failed in "Simple archive
> creation : Archive creation 2 (with listing)".
> The same occurred if I issued commands like "tla archives".
> 
> Examining the core file with gdb I found that all crashes occurred at
> the same location, namely in libawk/relational.c line 340 :
> 
> 333 void
> 334 rel_add_records (rel_table * table, ...)
> 335 {
> 336   va_list rp;
> 337   rel_record r;
> 338
> 339   va_start (rp, table);
> 340   for (r = va_arg (rp, rel_record); r._c; r = va_arg (rp, rel_record))
> 341     {
> 342       *(rel_record *)ar_push ((void **)&table->_r, 0, sizeof
> (rel_record)) = r;
> 343     }
> 344   va_end (rp);
> 345 }
> 
> In the archive creation test for example this routine was called by
> function directory_files() in libfsutils/dir-listing.c line 29 :
>        rel_add_records (&answer, rel_singleton_record_taking
> (rel_make_field_str (file)), 0);
> 
> In the developer mailing list I found a thread which possibly addresses
> the same problem:
> [GNU-arch-dev] Re: [BUG] Segfault in tla 1.3.1 and 1.3.1fix1
> http://lists.seyza.com/pipermail/gnu-arch-dev/2005-April/000974.html
> 
> I could figure out that the segfault occurred in the second call to
> va_arg(rp, rel_record) and the corresponding argument was the concluding
> 0. Obviously the compiler could not interpret the zero as rel_record
> type. The same observation applied to the other segfaults.
> 
> There is a simple solution: replace the 0 in the calling function by
> rel_record_nil so that the compiler knows about the intended type when
> building the argument list.
> However, the function rel_add_record is widely used by other routines in
> libarch, libfsutils and libawk. Thus there are quite a lot locations to 
> patch. After fixing all occurences no more segfaults occurred.
> 
> Now, as I was able to learn and try tla, I finally made a patchset
> including the fix and I would be glad if it could be merged into the
> next distribution.
> 
> 
> _______________________________________________
> Gnu-arch-users mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnu-arch-users
> 
> GNU arch home page:
> http://savannah.gnu.org/projects/gnu-arch/
-- 
Matthew Dempsky <address@hidden>

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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