The following issues were found
src/third_party/mozjs-60/extract/js/src/builtin/intl/SharedIntlData.cpp
3 issues
Line: 167
Column: 45
CWE codes:
126
for (const char* rawTimeZone : timezone::ianaZonesTreatedAsLinksByICU) {
MOZ_ASSERT(rawTimeZone != nullptr);
timeZone = Atomize(cx, rawTimeZone, strlen(rawTimeZone));
if (!timeZone)
return false;
TimeZoneHasher::Lookup lookup(timeZone);
TimeZoneSet::AddPtr p = ianaZonesTreatedAsLinksByICU.lookupForAdd(lookup);
Reported by FlawFinder.
Line: 195
Column: 45
CWE codes:
126
const char* rawTarget = linkAndTarget.target;
MOZ_ASSERT(rawLinkName != nullptr);
linkName = Atomize(cx, rawLinkName, strlen(rawLinkName));
if (!linkName)
return false;
MOZ_ASSERT(rawTarget != nullptr);
target = Atomize(cx, rawTarget, strlen(rawTarget));
Reported by FlawFinder.
Line: 200
Column: 41
CWE codes:
126
return false;
MOZ_ASSERT(rawTarget != nullptr);
target = Atomize(cx, rawTarget, strlen(rawTarget));
if (!target)
return false;
TimeZoneHasher::Lookup lookup(linkName);
TimeZoneMap::AddPtr p = ianaLinksCanonicalizedDifferentlyByICU.lookupForAdd(lookup);
Reported by FlawFinder.
src/third_party/boost/boost/regex/v5/cpp_regex_traits.hpp
3 issues
Line: 254
Column: 32
CWE codes:
362
std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
if((!cat_name.empty()) && (this->m_pmessages != 0))
{
cat = this->m_pmessages->open(
cat_name,
this->m_locale);
if((int)cat < 0)
{
std::string m("Unable to open message catalog: ");
Reported by FlawFinder.
Line: 611
Column: 32
CWE codes:
362
std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
if((!cat_name.empty()) && (this->m_pmessages != 0))
{
cat = this->m_pmessages->open(
cat_name,
this->m_locale);
if((int)cat < 0)
{
std::string m("Unable to open message catalog: ");
Reported by FlawFinder.
Line: 966
Column: 35
CWE codes:
362
std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
if ((!cat_name.empty()) && (m_pmessages != 0))
{
cat = this->m_pmessages->open(
cat_name,
this->m_locale);
if ((int)cat < 0)
{
std::string m("Unable to open message catalog: ");
Reported by FlawFinder.
src/third_party/boost/boost/asio/ip/basic_resolver_results.hpp
3 issues
Line: 147
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
using namespace std; // For memcpy.
typename InternetProtocol::endpoint endpoint;
endpoint.resize(static_cast<std::size_t>(address_info->ai_addrlen));
memcpy(endpoint.data(), address_info->ai_addr,
address_info->ai_addrlen);
results.values_->push_back(
basic_resolver_entry<InternetProtocol>(endpoint,
actual_host_name, service_name));
}
Reported by FlawFinder.
Line: 293
Column: 14
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
friend bool operator==(const basic_resolver_results& a,
const basic_resolver_results& b)
{
return a.equal(b);
}
/// Test two iterators for inequality.
friend bool operator!=(const basic_resolver_results& a,
const basic_resolver_results& b)
Reported by FlawFinder.
Line: 300
Column: 15
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
friend bool operator!=(const basic_resolver_results& a,
const basic_resolver_results& b)
{
return !a.equal(b);
}
private:
typedef std::vector<basic_resolver_entry<InternetProtocol> > values_type;
};
Reported by FlawFinder.
src/third_party/boost/boost/regex/v5/regex_traits_defaults.hpp
3 issues
Line: 761
Column: 51
CWE codes:
126
Suggestion:
This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it
return true;
#else
return ((p2 - p1) == (r.p2 - r.p1)) && std::equal(p1, p2, r.p1);
#endif
}
};
template <class charT>
int get_default_class_id(const charT* p1, const charT* p2)
Reported by FlawFinder.
Line: 837
Column: 17
CWE codes:
126
template<>
inline std::ptrdiff_t global_length<char>(const char* p)
{
return (std::strlen)(p);
}
#ifndef BOOST_NO_WREGEX
template<>
inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p)
{
Reported by FlawFinder.
Line: 843
Column: 33
CWE codes:
126
template<>
inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p)
{
return (std::ptrdiff_t)(std::wcslen)(p);
}
#endif
template <class charT>
inline charT global_lower(charT c)
{
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/common/ustr_wcs.cpp
3 issues
Line: 70
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
int32_t srcLength,
UErrorCode *pErrorCode){
char stackBuffer [_STACK_BUFFER_CAPACITY];
char* tempBuf = stackBuffer;
int32_t tempBufCapacity = _STACK_BUFFER_CAPACITY;
char* tempBufLimit = stackBuffer + tempBufCapacity;
UConverter* conv = NULL;
char* saveBuf = tempBuf;
Reported by FlawFinder.
Line: 296
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
UChar uStack [_STACK_BUFFER_CAPACITY];
wchar_t wStack[_STACK_BUFFER_CAPACITY];
wchar_t* pWStack = wStack;
char cStack[_STACK_BUFFER_CAPACITY];
int32_t cStackCap = _STACK_BUFFER_CAPACITY;
Reported by FlawFinder.
Line: 300
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
wchar_t* pWStack = wStack;
char cStack[_STACK_BUFFER_CAPACITY];
int32_t cStackCap = _STACK_BUFFER_CAPACITY;
char* pCSrc=cStack;
char* pCSave=pCSrc;
char* pCSrcLimit=NULL;
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/jit/PerfSpewer.cpp
3 issues
Line: 77
Column: 27
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
void
js::jit::CheckPerf() {
if (!PerfChecked) {
const char* env = getenv("IONPERF");
if (env == nullptr) {
PerfMode = PERF_MODE_NONE;
fprintf(stderr, "Warning: JIT perf reporting requires IONPERF set to \"block\" or \"func\". ");
fprintf(stderr, "Perf mapping will be deactivated.\n");
} else if (!strcmp(env, "none")) {
Reported by FlawFinder.
Line: 60
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
openPerfMap(const char* dir)
{
const ssize_t bufferSize = 256;
char filenameBuffer[bufferSize];
if (snprintf(filenameBuffer, bufferSize, "%sperf-%d.map", dir, getpid()) >= bufferSize)
return false;
MOZ_ASSERT(!PerfFilePtr);
Reported by FlawFinder.
Line: 66
Column: 19
CWE codes:
362
return false;
MOZ_ASSERT(!PerfFilePtr);
PerfFilePtr = fopen(filenameBuffer, "a");
if (!PerfFilePtr)
return false;
return true;
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/common/ucnv_bld.h
3 issues
Line: 68
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
typedef struct UConverterStaticData { /* +offset: size */
uint32_t structSize; /* +0: 4 Size of this structure */
char name
[UCNV_MAX_CONVERTER_NAME_LENGTH]; /* +4: 60 internal name of the converter- invariant chars */
int32_t codepage; /* +64: 4 codepage # (now IBM-$codepage) */
int8_t platform; /* +68: 1 platform of the converter (only IBM now) */
Reported by FlawFinder.
Line: 221
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
uint8_t subChar1; /* single-byte substitution character if different from subChar */
UBool useSubChar1;
char invalidCharBuffer[UCNV_MAX_CHAR_LEN]; /* bytes from last error/callback situation */
uint8_t charErrorBuffer[UCNV_ERROR_BUFFER_LENGTH]; /* codepage output from Error functions */
UChar subUChars[UCNV_MAX_SUBCHAR_LEN/U_SIZEOF_UCHAR]; /* see subChars documentation */
UChar invalidUCharBuffer[U16_MAX_LENGTH]; /* UChars from last error/callback situation */
UChar UCharErrorBuffer[UCNV_ERROR_BUFFER_LENGTH]; /* unicode output from Error functions */
Reported by FlawFinder.
Line: 233
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
/* store previous UChars/chars to continue partial matches */
UChar32 preFromUFirstCP; /* >=0: partial match */
UChar preFromU[UCNV_EXT_MAX_UCHARS];
char preToU[UCNV_EXT_MAX_BYTES];
int8_t preFromULength, preToULength; /* negative: replay */
int8_t preToUFirstLength; /* length of first character */
/* new fields for ICU 4.0 */
UConverterCallbackReason toUCallbackReason; /* (*fromCharErrorBehaviour) reason, set when error is detected */
Reported by FlawFinder.
src/third_party/icu4c-57.1/source/common/cwchar.h
3 issues
Line: 39
Column: 24
CWE codes:
120
Suggestion:
Consider using a function version that stops copying at the end of the buffer
/* The following are not available on all systems, defined in wchar.h or string.h. */
#if U_HAVE_WCSCPY
# define uprv_wcscpy wcscpy
# define uprv_wcscat wcscat
# define uprv_wcslen wcslen
#else
U_CAPI wchar_t* U_EXPORT2
uprv_wcscpy(wchar_t *dst, const wchar_t *src);
Reported by FlawFinder.
Line: 40
Column: 24
CWE codes:
120
/* The following are not available on all systems, defined in wchar.h or string.h. */
#if U_HAVE_WCSCPY
# define uprv_wcscpy wcscpy
# define uprv_wcscat wcscat
# define uprv_wcslen wcslen
#else
U_CAPI wchar_t* U_EXPORT2
uprv_wcscpy(wchar_t *dst, const wchar_t *src);
U_CAPI wchar_t* U_EXPORT2
Reported by FlawFinder.
Line: 41
Column: 24
CWE codes:
126
#if U_HAVE_WCSCPY
# define uprv_wcscpy wcscpy
# define uprv_wcscat wcscat
# define uprv_wcslen wcslen
#else
U_CAPI wchar_t* U_EXPORT2
uprv_wcscpy(wchar_t *dst, const wchar_t *src);
U_CAPI wchar_t* U_EXPORT2
uprv_wcscat(wchar_t *dst, const wchar_t *src);
Reported by FlawFinder.
src/third_party/mozjs-60/extract/js/src/vm/StringType.cpp
3 issues
Line: 1968
template JSString*
js::ToStringSlow<NoGC>(JSContext* cx, const Value& arg);
JS_PUBLIC_API(JSString*)
js::ToStringSlow(JSContext* cx, HandleValue v)
{
return ToStringSlow<CanGC>(cx, v);
}
Reported by Cppcheck.
Line: 906
Column: 21
CWE codes:
126
bool
js::StringEqualsAscii(JSLinearString* str, const char* asciiBytes)
{
size_t length = strlen(asciiBytes);
#ifdef DEBUG
for (size_t i = 0; i != length; ++i)
MOZ_ASSERT(unsigned(asciiBytes[i]) <= 127);
#endif
if (length != str->length())
Reported by FlawFinder.
Line: 1562
Column: 72
CWE codes:
126
JSFlatString*
NewLatin1StringZ(JSContext* cx, UniqueChars chars)
{
JSFlatString* str = NewString<CanGC>(cx, (Latin1Char*)chars.get(), strlen(chars.get()));
if (!str)
return nullptr;
mozilla::Unused << chars.release();
return str;
Reported by FlawFinder.
src/third_party/boost/boost/smart_ptr/detail/lwm_win32_cs.hpp
3 issues
Line: 52
Column: 49
CWE codes:
Suggestion:
Use InitializeCriticalSectionAndSpinCount instead
#endif
};
extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *);
extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *);
extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *);
extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *);
typedef ::_RTL_CRITICAL_SECTION rtl_critical_section;
Reported by FlawFinder.
Line: 63
Column: 9
CWE codes:
Suggestion:
Use InitializeCriticalSectionAndSpinCount instead
typedef ::CRITICAL_SECTION critical_section;
using ::InitializeCriticalSection;
using ::EnterCriticalSection;
using ::LeaveCriticalSection;
using ::DeleteCriticalSection;
typedef ::CRITICAL_SECTION rtl_critical_section;
Reported by FlawFinder.
Line: 85
Column: 24
CWE codes:
Suggestion:
Use InitializeCriticalSectionAndSpinCount instead
lightweight_mutex()
{
boost::detail::InitializeCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_));
}
~lightweight_mutex()
{
boost::detail::DeleteCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_));
Reported by FlawFinder.