[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] expand_html() msw64: 'SIZE_MAX <= index' always false
From: |
Greg Chicares |
Subject: |
[lmi] expand_html() msw64: 'SIZE_MAX <= index' always false |
Date: |
Sun, 24 Mar 2019 10:09:21 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 |
Vadim--is this the right fix for the problem below?
---------8<--------8<--------8<--------8<--------8<--------8<--------8<-------
diff --git a/pdf_command_wx.cpp b/pdf_command_wx.cpp
index c90f4938..3a40f278 100644
--- a/pdf_command_wx.cpp
+++ b/pdf_command_wx.cpp
@@ -269,7 +269,7 @@ class html_interpolator
}
char* stop = nullptr;
- auto const index = std::strtoul(s.c_str() + open_pos + 1, &stop,
10);
+ auto const index = std::strtoull(s.c_str() + open_pos + 1, &stop,
10);
// Conversion must have stopped at the closing bracket character
// and also check for overflow (notice that index == SIZE_MAX
--------->8-------->8-------->8-------->8-------->8-------->8-------->8-------
To reproduce:
x86_64-w64-mingw32-g++ -MMD -MP -MT pdf_command_wx.o -MF pdf_command_wx.d -c
-I /opt/lmi/src/lmi -I /opt/lmi/src/lmi/tools/pete-2.1.1 -I
/opt/lmi/x86_64-w64-mingw32/local/lib/wx/include/x86_64-w64-mingw32-msw-unicode-3.1
-I /opt/lmi/x86_64-w64-mingw32/local/include/wx-3.1 -I
/opt/lmi/third_party/include -I /opt/lmi/third_party/src -I
/opt/lmi/x86_64-w64-mingw32/local/include -I
/opt/lmi/x86_64-w64-mingw32/local/include/libxml2 -DLMI_WX_NEW_USE_SO
-DLIBXML_USE_DLL -DSTRICT -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMSW__
-DBOOST_NO_AUTO_PTR -DBOOST_STRICT_CONFIG -DBOOST_STATIC_ASSERT_HPP
-frounding-math -std=c++17 -pedantic-errors -Werror -Wall -Walloc-zero -Walloca
-Wcast-align -Wconversion -Wdangling-else -Wdeprecated-declarations
-Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches
-Wduplicated-cond -Wextra -Wformat-nonliteral -Wformat-security
-Wformat-signedness -Wformat-y2k -Wimport -Winit-self -Winvalid-pch
-Wlogical-op -Wmissing-include-dirs -Wmultichar -Wnull-dereference -Wpacked
-Wpointer-arith -Wredundant-decls -Wrestrict -Wshadow -Wsign-compare
-Wstack-protector -Wswitch-enum -Wtrampolines -Wundef -Wunreachable-code
-Wunused-macros -Wvector-operation-performance -Wwrite-strings -Wno-parentheses
-Wc++11-compat -Wc++14-compat -Wc++1z-compat -Wconditionally-supported
-Wctor-dtor-privacy -Wdelete-non-virtual-dtor -Wdeprecated -Wnoexcept
-Wnoexcept-type -Wnon-template-friend -Wnon-virtual-dtor -Woverloaded-virtual
-Wpmf-conversions -Wregister -Wreorder -Wstrict-null-sentinel -Wsynth
-Wuseless-cast -Wcast-qual -D'BOOST_STATIC_ASSERT(A)=static_assert((A))'
-ggdb -O2 /opt/lmi/src/lmi/pdf_command_wx.cpp -opdf_command_wx.o
/opt/lmi/src/lmi/pdf_command_wx.cpp: In member function 'html::text
{anonymous}::html_interpolator::expand_html(const string&) const':
/opt/lmi/src/lmi/pdf_command_wx.cpp:278:63: error: comparison is always false
due to limited range of data type [-Werror=type-limits]
if(stop != s.c_str() + s.length() - 1 || SIZE_MAX <= index)
^
cc1plus: all warnings being treated as errors
- [lmi] expand_html() msw64: 'SIZE_MAX <= index' always false,
Greg Chicares <=