From 6d46346eb93d5032c08cf1e39023b5d57260a766 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 29 Aug 2017 12:21:29 -0400 Subject: Detect integer overflow/underflow --- include/qpdf/QUtil.hh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 2c58475c..79db229f 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -29,8 +29,12 @@ namespace QUtil QPDF_DLL std::string double_to_string(double, int decimal_places = 0); + // These string to number methods throw std::runtime_error on + // underflow/overflow. QPDF_DLL long long string_to_ll(char const* str); + QPDF_DLL + int string_to_int(char const* str); // Pipeline's write method wants unsigned char*, but we often have // some other type of string. These methods do combinations of -- cgit v1.2.3-70-g09d2