summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-21 22:50:15 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-22 09:00:57 +0000
commit7778d9f51bd1f4d086cafe95995406c3157afb89 (patch)
tree9a43660947b78d9f714c45e1be48ef46dd0d082e /hwpfilter
parent02bccbe0d59e50a7fd987c81c4d15b2fd4d24538 (diff)
Prevent calls to rtl/character.hxx functions with (signed) char arguments
...that would implicitly be sign extended (for plain char only if it is signed), so non-ASCII char values would trigger the isUnicodeCodePoint assert. Change-Id: Iaf8024ad509e64525558e882fe3fd078cfb4ea91 Reviewed-on: https://gerrit.libreoffice.org/35523 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hbox.cxx5
-rw-r--r--hwpfilter/source/hwpeq.cxx20
2 files changed, 15 insertions, 10 deletions
diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx
index fcf1026179e1..3701f9298720 100644
--- a/hwpfilter/source/hbox.cxx
+++ b/hwpfilter/source/hbox.cxx
@@ -581,7 +581,8 @@ static void getOutlineNumStr(int style, int level, int num, hchar * hstr)
ptr = buf;
while (*ptr)
{
- *ptr = sal::static_int_cast<char>(rtl::toAsciiUpperCase(*ptr));
+ *ptr = sal::static_int_cast<char>(
+ rtl::toAsciiUpperCase(static_cast<unsigned char>(*ptr)));
ptr++;
}
}
@@ -683,7 +684,7 @@ hchar_string Outline::GetUnicode() const
char *ptr = dest;
while( *ptr )
{
- *ptr = sal::static_int_cast<char>(rtl::toAsciiUpperCase(*ptr));
+ *ptr = sal::static_int_cast<char>(rtl::toAsciiUpperCase(static_cast<unsigned char>(*ptr)));
ptr++;
}
}
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index e7afd609524c..170a68c81ed1 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -418,15 +418,16 @@ void make_keyword( char *keyword, const char *token)
memcpy(keyword, token, len);
keyword[len] = 0;
- if( (token[0] & 0x80) || rtl::isAsciiLowerCase(token[0]) || strlen(token) < 2 )
+ if( (token[0] & 0x80) || rtl::isAsciiLowerCase(static_cast<unsigned char>(token[0])) || strlen(token) < 2 )
return;
- bool capital = rtl::isAsciiUpperCase(keyword[1]);
+ bool capital = rtl::isAsciiUpperCase(
+ static_cast<unsigned char>(keyword[1]));
for( ptr = keyword + 2; *ptr && result; ptr++ )
{
if( (*ptr & 0x80) ||
- (!capital && rtl::isAsciiUpperCase(*ptr)) ||
- (capital && rtl::isAsciiLowerCase(*ptr)) )
+ (!capital && rtl::isAsciiUpperCase(static_cast<unsigned char>(*ptr))) ||
+ (capital && rtl::isAsciiLowerCase(static_cast<unsigned char>(*ptr))) )
{
result = false;
}
@@ -437,8 +438,9 @@ void make_keyword( char *keyword, const char *token)
ptr = keyword;
while( *ptr )
{
- if( rtl::isAsciiUpperCase(*ptr) )
- *ptr = sal::static_int_cast<char>(rtl::toAsciiLowerCase(*ptr));
+ if( rtl::isAsciiUpperCase(static_cast<unsigned char>(*ptr)) )
+ *ptr = sal::static_int_cast<char>(
+ rtl::toAsciiLowerCase(static_cast<unsigned char>(*ptr)));
ptr++;
}
}
@@ -689,8 +691,10 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
key[0] = '\\';
strcpy(key + 1, eq->key);
}
- if( (eq->flag & EQ_CASE) && rtl::isAsciiUpperCase(token[0]) )
- key[1] = sal::static_int_cast<char>(rtl::toAsciiUpperCase(key[1]));
+ if( (eq->flag & EQ_CASE)
+ && rtl::isAsciiUpperCase(static_cast<unsigned char>(token[0])) )
+ key[1] = sal::static_int_cast<char>(
+ rtl::toAsciiUpperCase(static_cast<unsigned char>(key[1])));
token = key;
}