This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
rs6000 : too short memory allocation
- From: "Christophe Jaillet" <christophe dot jaillet at wanadoo dot fr>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 14 Feb 2005 00:36:21 +0100
- Subject: rs6000 : too short memory allocation
Description : in gcc/config/rs6000/rs6000.c, a string is allocated using
alloca and then filled using a sprintf.
I think that the allocated string is 1 byte too short. The format used with
sprintf is \"L%011d$spb\", so there should be up to 11 '0' in the result not
only 10.
NOT BOOT STRAPPED.
2005-02-13 Christophe Jaillet <christophe.jaillet@wanadoo.fr>
* rs6000.c (machopic_output_stub): correct size for alloca (was 1 byte
too short)
*** gcc-4.0-20050130/gcc/config/rs6000/rs6000.c Thu Feb 10 19:27:44 2005
--- my_patch/rs6000.c Sun Feb 13 18:53:04 2005
*************** machopic_output_stub (FILE *file, const
*** 17635,17641 ****
fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
label++;
! local_label_0 = alloca (sizeof("\"L0000000000$spb\""));
sprintf (local_label_0, "\"L%011d$spb\"", label);
fprintf (file, "\tmflr r0\n");
--- 17635,17641 ----
fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
label++;
! local_label_0 = alloca (sizeof("\"L00000000000$spb\""));
sprintf (local_label_0, "\"L%011d$spb\"", label);
fprintf (file, "\tmflr r0\n");