Skip to content

Commit 5cc7b26

Browse files
Merge remote-tracking branch 'dhewm3/master'
2 parents f19887a + b4c4aa5 commit 5cc7b26

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

neo/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,16 +335,24 @@ if(D3_COMPILER_IS_GCC_OR_CLANG)
335335
set(sys_libs ${sys_libs} -fsanitize=undefined)
336336
endif()
337337

338-
CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" cxx_has_fvisibility)
339-
if(NOT cxx_has_fvisibility)
340-
message(FATAL_ERROR "Compiler does not support -fvisibility")
338+
if(NOT WIN32)
339+
CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" cxx_has_fvisibility)
340+
if(NOT cxx_has_fvisibility)
341+
message(FATAL_ERROR "Compiler does not support -fvisibility")
342+
endif()
343+
add_compile_options(-fvisibility=hidden)
341344
endif()
342345
add_compile_options(-fvisibility=hidden)
343346

344347
# TODO fix these warnings
345348
add_compile_options(-Wno-sign-compare)
346349
add_compile_options(-Wno-switch)
347350

351+
CHECK_CXX_COMPILER_FLAG("-Wdangling-reference" cxx_has_Wdangling_reference)
352+
if(cxx_has_Wdangling_reference)
353+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=dangling-reference")
354+
endif()
355+
348356
CHECK_CXX_COMPILER_FLAG("-Woverloaded-virtual" cxx_has_Woverload_virtual)
349357
if(cxx_has_Woverload_virtual)
350358
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")

neo/idlib/Str.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,12 @@ char * D3_ISO8859_1toUTF8( const char* isoStr, char *utf8buf, int utf8bufLen )
19971997
++str;
19981998
}
19991999
}
2000+
if(i > n) {
2001+
// last written codepoint used two chars
2002+
// => would be out of bounds with terminating \0
2003+
// => utf8buf was too short, return NULL
2004+
return NULL;
2005+
}
20002006
buffer[i] = '\0';
20012007
return utf8buf;
20022008
}

0 commit comments

Comments
 (0)