This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Unitialized memory in output_file_names


On Tue, Mar 13, 2001 at 05:58:46PM +0200, Momchil Velikov wrote:
> This patch fixes a read of uninitialized variable.
> 
> 2001-03-13  Momchil Velikov  <velco@fadata.bg>
> 
> 	* gcc/dwarf2out.c (output_file_names): Don't access initialized
> 	``dir[1].length''.
> 
> Index: gcc/dwarf2out.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
> retrieving revision 1.242.2.2
> diff -c -3 -p -r1.242.2.2 dwarf2out.c
> *** dwarf2out.c	2001/02/21 14:56:06	1.242.2.2
> --- dwarf2out.c	2001/03/13 16:23:52
> *************** output_file_names ()
> *** 6762,6768 ****
>     dirs[0].path = files[1].path;
>     dirs[0].length = files[1].fname - files[1].path;
>     dirs[0].prefix = -1;
> !   dirs[0].nbytes = files[1].length - dirs[1].length + 1;
>     dirs[0].count = 1;
>     dirs[0].dir_idx = 0;
>     dirs[0].used = 0;
> --- 6766,6772 ----
>     dirs[0].path = files[1].path;
>     dirs[0].length = files[1].fname - files[1].path;
>     dirs[0].prefix = -1;
> !   dirs[0].nbytes = files[1].length - dirs[0].length + 1;
>     dirs[0].count = 1;
>     dirs[0].dir_idx = 0;
>     dirs[0].used = 0;

There is a similar problem 26 lines down where it states

        dirs[ndirs].nbytes = files[i].length - dirs[i].length + 1;

This should probably be

        dirs[ndirs].nbytes = files[i].length - dirs[ndirs].length + 1;

Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]