Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-57206

Compiler warnings in JSStringWrapper::JSStringWrapper

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • Dev Platform 2021-06-14

      I got a compiler warning below when building from source

      In file included from /usr/include/string.h:494,
      from /usr/include/c++/9/cstring:42,
      from src/third_party/mozjs-60/include/mozilla/Span.h:33,
      from src/third_party/mozjs-60/include/mozilla/Range.h:12,
      from src/third_party/mozjs-60/include/jsapi.h:15,
      from src/mongo/scripting/mozjs/jsstringwrapper.h:33,
      from src/mongo/scripting/mozjs/jsstringwrapper.cpp:32:
      In function 'char* strncpy(char*, const char*, size_t)',
      inlined from 'mongo::mozjs::JSStringWrapper::JSStringWrapper(int32_t)' at src/mongo/scripting/mozjs/jsstringwrapper.cpp:48:12:
      /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 64 equals destination size [-Werror=stringop-truncation]
      106 | return _builtin_strncpy_chk (dest, __src, __len, __bos (_dest));

      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            1975643103@qq.com Yingdong Yuan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: