Skip to content

Commit 93c5114

Browse files
author
Mark Wielaard
committed
libasm: Fix one GCC7 -Wformat-truncation=2 warning.
Make sure that if we have really lots of labels the tempsym doesn't get truncated because it is too small to hold the whole name. This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed out by enabling this warning because there are currently some issues with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448 Signed-off-by: Mark Wielaard <mark@klomp.org>
1 parent b1042ce commit 93c5114

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

libasm/ChangeLog

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
2017-02-12 Mark Wielaard <mjw@redhat.com>
2+
3+
* asm_newsym.c (asm_newsym): Increase TEMPSYMLEN to 13.
4+
15
2017-02-15 Ulf Hermann <ulf.hermann@qt.io>
26

37
* disasm_str.c: Include system.h.
48

5-
2015-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
9+
2016-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
610

711
* asm_align.c: Remove sys/param.h include.
812

libasm/asm_newsym.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Define new symbol for current position in given section.
2-
Copyright (C) 2002, 2005, 2016 Red Hat, Inc.
2+
Copyright (C) 2002, 2005, 2016, 2017 Red Hat, Inc.
33
This file is part of elfutils.
44
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
55
@@ -44,7 +44,9 @@ AsmSym_t *
4444
asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size,
4545
int type, int binding)
4646
{
47-
#define TEMPSYMLEN 10
47+
/* We don't really expect labels with many digits, but in theory it could
48+
be 10 digits (plus ".L" and a zero terminator). */
49+
#define TEMPSYMLEN 13
4850
char tempsym[TEMPSYMLEN];
4951
AsmSym_t *result;
5052

0 commit comments

Comments
 (0)