Open Bug 1437877 Opened 7 years ago Updated 2 years ago

Updater.cpp: -Wformat-truncation on a bunch of snprintf

Categories

(Toolkit :: Application Update, defect, P5)

defect

Tracking

()

People

(Reporter: Sylvestre, Unassigned)

References

Details

Attachments

(1 file)

gcc-8 is unhappy about some truncations that we are doing on some snprintf.

Indeed, the target is usually of a length MAXPATHLEN, so is the source.
With the string being added (like .log), if the ath is exactly 1024 chars, it might break updates.

 /root/firefox-gcc-last/toolkit/mozapps/update/tests/TestAUSHelper.cpp: In function 'int main(int, NS_tchar**)':
 /root/firefox-gcc-last/toolkit/mozapps/update/tests/TestAUSHelper.cpp:157:25: error: '.running' directive output may be truncated writing 8 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                     NS_T("%s.running"), exePath);
                          ^~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/tests/TestAUSHelper.cpp:49:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/throw_gcc.h:13,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/stl_wrappers/cstdlib:64,
                  from /usr/include/c++/8/stdlib.h:36,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdlib.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/tests/TestAUSHelper.cpp:62:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 9 and 1032 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/tests/TestAUSHelper.cpp:180:25: error: '.log' directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                     NS_T("%s.log"), exePath);
                          ^~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/tests/TestAUSHelper.cpp:49:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/throw_gcc.h:13,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/stl_wrappers/cstdlib:64,
                  from /usr/include/c++/8/stdlib.h:36,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdlib.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/tests/TestAUSHelper.cpp:62:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 5 and 1028 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 cc1plus: all warnings being treated as errors
 /root/firefox-gcc-last/config/rules.mk:1047: recipe for target 'TestAUSHelper.o' failed
 make[4]: *** [TestAUSHelper.o] Error 1
 make[4]: Leaving directory '/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/toolkit/mozapps/update/tests'
 /root/firefox-gcc-last/config/recurse.mk:73: recipe for target 'toolkit/mozapps/update/tests/target' failed
 make[3]: *** [toolkit/mozapps/update/tests/target] Error 2
 make[3]: *** Waiting for unfinished jobs....
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp: In function 'bool WriteStatusFile(const char*)':
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2133:21: error: '/update.status' directive output may be truncated writing 14 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s/update.status"), gPatchDirPath);
                      ^~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 15 and 1038 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp: In function 'bool WriteStatusFile(const char*)':
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2133:21: error: '/update.status' directive output may be truncated writing 14 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s/update.status"), gPatchDirPath);
                      ^~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 15 and 1038 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp: In function 'void UpdateThreadFunc(void*)':
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2471:21: error: '/update.mar' directive output may be truncated writing 11 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s/update.mar"), gPatchDirPath);
                      ^~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 12 and 1035 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:778:49: error: '%s' directive output may be truncated writing 7 bytes into a region of size between 0 and 1023 [-Werror=format-truncation=]
      NS_tsnprintf(paths[index], MAXPATHLEN, NS_T("%s/%s"), path, suffix);
                                                  ^~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 9 and 1032 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:778:49: error: '%s' directive output may be truncated writing 9 bytes into a region of size between 0 and 1023 [-Werror=format-truncation=]
      NS_tsnprintf(paths[index], MAXPATHLEN, NS_T("%s/%s"), path, suffix);
                                                  ^~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 11 and 1034 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:4137:21: error: '/updating/update.manifest' directive output may be truncated writing 25 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s/updating/update.manifest"), gWorkingDirPath);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 26 and 1049 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2538:25: error: '/updating' directive output may be truncated writing 9 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                     NS_T("%s/updating"), gWorkingDirPath);
                          ^~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 10 and 1033 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2314:21: error: '.bak' directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s.bak"), destDir);
                      ^~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 5 and 1028 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2322:21: error: '.bak/updated' directive output may be truncated writing 12 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s.bak/updated"),
                      ^~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 13 and 1036 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2389:21: error: '/updates/last-update.log' directive output may be truncated writing 24 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s/updates/last-update.log"), tmpDir);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 25 and 1048 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2393:23: error: '/updates/last-update.log' directive output may be truncated writing 24 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                   NS_T("%s/updates/last-update.log"), destDir);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 25 and 1048 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 cc1plus: all warnings being treated as errors
 /root/firefox-gcc-last/config/rules.mk:1047: recipe for target 'updater.o' failed
 make[4]: *** [updater.o] Error 1
 make[4]: Leaving directory '/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/toolkit/mozapps/update/updater'
 /root/firefox-gcc-last/config/recurse.mk:73: recipe for target 'toolkit/mozapps/update/updater/target' failed
 make[3]: *** [toolkit/mozapps/update/updater/target] Error 2
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp: In function 'void UpdateThreadFunc(void*)':
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2471:21: error: '/update.mar' directive output may be truncated writing 11 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s/update.mar"), gPatchDirPath);
                      ^~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 12 and 1035 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:778:49: error: '%s' directive output may be truncated writing 7 bytes into a region of size between 0 and 1023 [-Werror=format-truncation=]
      NS_tsnprintf(paths[index], MAXPATHLEN, NS_T("%s/%s"), path, suffix);
                                                  ^~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 9 and 1032 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:778:49: error: '%s' directive output may be truncated writing 9 bytes into a region of size between 0 and 1023 [-Werror=format-truncation=]
      NS_tsnprintf(paths[index], MAXPATHLEN, NS_T("%s/%s"), path, suffix);
                                                  ^~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 11 and 1034 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:4137:21: error: '/updating/update.manifest' directive output may be truncated writing 25 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s/updating/update.manifest"), gWorkingDirPath);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 26 and 1049 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2538:25: error: '/updating' directive output may be truncated writing 9 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                     NS_T("%s/updating"), gWorkingDirPath);
                          ^~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 10 and 1033 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2314:21: error: '.bak' directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s.bak"), destDir);
                      ^~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 5 and 1028 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2322:21: error: '.bak/updated' directive output may be truncated writing 12 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s.bak/updated"),
                      ^~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 13 and 1036 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2389:21: error: '/updates/last-update.log' directive output may be truncated writing 24 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                 NS_T("%s/updates/last-update.log"), tmpDir);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 25 and 1048 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 In file included from /root/firefox-gcc-last/toolkit/mozapps/update/updater/progressui.h:10,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:33:
 /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:2393:23: error: '/updates/last-update.log' directive output may be truncated writing 24 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
                   NS_T("%s/updates/last-update.log"), destDir);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /root/firefox-gcc-last/toolkit/mozapps/update/common/updatedefines.h:113:20: note: in definition of macro 'NS_T'
  # define NS_T(str) str
                     ^~~
 In file included from /usr/include/stdio.h:938,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/system_wrappers/stdio.h:3,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/bspatch.h:36,
                  from /root/firefox-gcc-last/toolkit/mozapps/update/updater/updater.cpp:32:
 /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:35: note: '__builtin___snprintf_chk' output between 25 and 1048 bytes into a destination of size 1024
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
           ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         __bos (__s), __fmt, __va_arg_pack ());
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 cc1plus: all warnings being treated as errors
 /root/firefox-gcc-last/config/rules.mk:1047: recipe for target 'updater.o' failed
Robert, any suggestion here?
I could just double the size of the target (MAXPATHLEN*2 for example).
Flags: needinfo?(robert.strong.bugs)
Comment on attachment 8957894 [details]
Bug 1437877 - Updater: Disable -Wformat-truncation until the reported issues are fixed

https://reviewboard.mozilla.org/r/226862/#review233032
Attachment #8957894 - Flags: review?(mh+mozilla) → review+
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8f1b2f872f0e
Updater: Disable -Wformat-truncation until the reported issues are fixed r=glandium
Keywords: leave-open
https://hg.mozilla.org/integration/mozilla-inbound/rev/b3d94aa6bbd8e0e784adb05966df183fd4e7837e
Bug 1437877 - Updater tests: Disable -Wformat-truncation until the reported issues are fixed r=glandium
The leave-open keyword is there and there is no activity for 6 months.
:rstrong, maybe it's time to close this bug?
Flags: needinfo?(robert.strong.bugs)
This is a good cleanup bug for when someone has spare cycles... let's keep it open.
Flags: needinfo?(robert.strong.bugs)
No longer depends on: 1530240

I fixed TestAUSHelper.cpp in bug 1530564

Depends on: 1530564
Summary: Updater.cpp & TestAUSHelper.cpp: -Wformat-truncation on a bunch of snprintf → Updater.cpp: -Wformat-truncation on a bunch of snprintf
Priority: -- → P5

The leave-open keyword is there and there is no activity for 6 months.
:rstrong, maybe it's time to close this bug?

Flags: needinfo?(robert.strong.bugs)

The previous comment still applies.
(In reply to Robert Strong [:rstrong] (Robert they/them - use needinfo to contact me) from comment #11)

This is a good cleanup bug for when someone has spare cycles... let's keep
it open.

I'll remove the leave-open keyword so this notification doesn't happen in the future.

Flags: needinfo?(robert.strong.bugs)
Keywords: leave-open
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: