dash icon indicating copy to clipboard operation
dash copied to clipboard

locality: pass real upper bound to strncpy

Open devreal opened this issue 5 years ago • 3 comments

Based on a warning from GCC 9.2.0

devreal avatar Feb 25 '20 10:02 devreal

Codecov Report

Merging #694 into development will decrease coverage by 0.27%. The diff coverage is 0.00%.

@@               Coverage Diff               @@
##           development     #694      +/-   ##
===============================================
- Coverage        84.09%   83.82%   -0.28%     
===============================================
  Files              336      336              
  Lines            25003    25004       +1     
  Branches         11366    11367       +1     
===============================================
- Hits             21026    20959      -67     
- Misses            3693     3694       +1     
- Partials           284      351      +67     
Impacted Files Coverage Δ
dart-impl/base/src/locality.c 25.50% <0.00%> (-0.07%) :arrow_down:
dash/include/dash/internal/Logging.h 59.09% <0.00%> (-40.91%) :arrow_down:
dash/include/dash/algorithm/Generate.h 68.75% <0.00%> (-31.25%) :arrow_down:
...h/include/dash/pattern/internal/PatternArguments.h 78.68% <0.00%> (-16.40%) :arrow_down:
dash/include/dash/pattern/CSRPattern.h 72.67% <0.00%> (-15.70%) :arrow_down:
dash/include/dash/algorithm/Copy.h 77.69% <0.00%> (-13.85%) :arrow_down:
dash/include/dash/TeamSpec.h 71.57% <0.00%> (-12.64%) :arrow_down:
...h/include/dash/iterator/internal/ContiguousRange.h 87.64% <0.00%> (-10.12%) :arrow_down:
dash/include/dash/iterator/GlobIter.h 85.14% <0.00%> (-6.94%) :arrow_down:
dash/include/dash/atomic/GlobAtomicRef.h 94.93% <0.00%> (-5.07%) :arrow_down:
... and 30 more

codecov[bot] avatar Feb 25 '20 11:02 codecov[bot]

These are my current warnings without the patch:

mpicc -c -o dart-impl/base/src/internal/domain_locality.o -DSPEC -DNDEBUG -Iinclude -DBOOST_ALL_NO_LIB  -Idart-impl/mpi/include -Idart-impl/mpi/src -Idart-impl/base/include -DDART_HAVE_SYNC_BUILTINS -DDART  -O3 -march=native        -DDASH_HAVE_STD_TRIVIALLY_COPYABLE -DDART_MPI_DISABLE_SHARED_WINDOWS         dart-impl/base/src/internal/domain_locality.c
dart-impl/base/src/internal/domain_locality.c: In function 'dart__base__locality__domain__create_module_subdomains.part.4':
dart-impl/base/src/internal/domain_locality.c:1062:18: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
              "%s.%d", module_domain->domain_tag,
                  ^~
dart-impl/base/src/internal/domain_locality.c:1062:14: note: directive argument in the range [0, 2147483647]
              "%s.%d", module_domain->domain_tag,
              ^~~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from dart-impl/base/include/dash/dart/base/logging.h:9,
                 from dart-impl/base/src/internal/domain_locality.c:11:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 3 and 139 bytes into a destination of size 128
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dart-impl/base/src/internal/domain_locality.c: In function 'dart__base__locality__domain__update_subdomains':
dart-impl/base/src/internal/domain_locality.c:261:18: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
              "%s.%d", domain->domain_tag, sd);
                  ^~
dart-impl/base/src/internal/domain_locality.c:261:14: note: directive argument in the range [0, 2147483647]
              "%s.%d", domain->domain_tag, sd);
              ^~~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from dart-impl/base/include/dash/dart/base/logging.h:9,
                 from dart-impl/base/src/internal/domain_locality.c:11:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 3 and 139 bytes into a destination of size 128
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dart-impl/base/src/internal/domain_locality.c:261:18: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
              "%s.%d", domain->domain_tag, sd);
                  ^~
dart-impl/base/src/internal/domain_locality.c:261:14: note: directive argument in the range [0, 2147483647]
              "%s.%d", domain->domain_tag, sd);
              ^~~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from dart-impl/base/include/dash/dart/base/logging.h:9,
                 from dart-impl/base/src/internal/domain_locality.c:11:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 3 and 139 bytes into a destination of size 128
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dart-impl/base/src/internal/domain_locality.c: In function 'dart__base__locality__domain__create_node_subdomains':
dart-impl/base/src/internal/domain_locality.c:819:18: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
              "%s.%d", node_domain->domain_tag,
                  ^~
dart-impl/base/src/internal/domain_locality.c:819:14: note: directive argument in the range [0, 2147483647]
              "%s.%d", node_domain->domain_tag,
              ^~~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from dart-impl/base/include/dash/dart/base/logging.h:9,
                 from dart-impl/base/src/internal/domain_locality.c:11:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 3 and 139 bytes into a destination of size 128
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I will see what you patch fixes.

bertwesarg avatar Mar 02 '20 15:03 bertwesarg

Obviously none, because that are two different files ;-)

bertwesarg avatar Mar 02 '20 15:03 bertwesarg