format-truncation

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

 



Hello

I am having trouble identifying how to fix the following error we encounter
when compiling AROS using our patched gcc 8.2.

Compile failed: ccache
/home/nick/builds/pc-x86_64-smp-gcc8/bin/linux-x86_64/tools/crosstools/x86_64-aros-gcc
-iquote
/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/Ports/acpica/acpica-unix-20190108/source/components/utilities/
-iquote /mnt/c/Users/kalam/AROS/svn-repo/AROS/arch/all-pc/acpica -iquote .
-mcmodel=large -mno-red-zone -mno-ms-bitfields -O2
-fno-asynchronous-unwind-tables -fno-omit-frame-pointer -Wall -Werror
-Wno-pointer-sign -Wno-parentheses -Wno-strict-aliasing
-I/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/AROS/Developer/include/acpica
-iquote
/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/Ports/acpica/acpica-unix-20190108/source/include
-iquote
/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/Ports/acpica/acpica-unix-20190108/source/include/platform
-DAROS_BUILD_TYPE=AROS_BUILD_TYPE_PERSONAL
-I/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/gen/arch/all-pc/acpica/acpica/include
-include
/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/gen/arch/all-pc/acpica/acpica/include/acpica_deflibdefs.h
-D__SRCFILENAME__="bin/pc-x86_64-smp/Ports/acpica/acpica-unix-20190108/source/components/utilities/utprint.c"
-c
/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/Ports/acpica/acpica-unix-20190108/source/components/utilities/utprint.c
-o
/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/gen/arch/all-pc/acpica/acpica/utprint.o
/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/Ports/acpica/acpica-unix-20190108/source/components/utilities/utprint.c:
In function 'sprintf':
/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/Ports/acpica/acpica-unix-20190108/source/components/utilities/utprint.c:880:14:
error: specified bound 4294967295 exceeds 'INT_MAX'
[-Werror=format-truncation=]
     Length = vsnprintf (String, ACPI_UINT32_MAX, Format, Args);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
mmakefile:918: recipe for target
'/home/nick/builds/pc-x86_64-smp-gcc8/bin/pc-x86_64-smp/gen/arch/all-pc/acpica/acpica/utprint.o'
failed

My problem is I cannot see where it is getting "INT_MAX" from as the bounds
for the 2nd parameter.

The documentation for vsnprintf says "If the *maxlen* value is 0, no
characters are written, and *vsnprintf* returns 0. If the value is greater
than *INT_MAX* , then *vsnprintf* behaves identically to *vsprintf* in that
no limit checking is done on the number of characters written to the output
area. No warnings concerning length errors are produced by *vsnprintf* ,
and the only indication that the output may have been truncated or is
incomplete is a negative return value."

We expose vsnprintf in our stdio.h as -:
int vsnprintf(char * restrict s, size_t n, const char * restrict format,
 va_list arg);

where size_t is typedef'd as -:
typedef long unsigned int size_t;

and SIZE_MAX is defined -:
#  if __WORDSIZE == 64
#     define SIZE_MAX  UINT64_MAX
#  else
#     define SIZE_MAX  UINT32_MAX
#  endif

Any suggestions on how to approach this would be greatly appreciated.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux