diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-21 10:40:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-21 11:55:13 +0000 |
commit | fcf43d7e8a908a303ccae274dcd6668aa93d4d50 (patch) | |
tree | 3cdc119599906b34194d5b1997afb0321c305e07 /vcl | |
parent | 46bdfa98c107e0aba92e42b46c0c5a287251017b (diff) |
coverity#1213367 rework to make comparison to len more clear
Change-Id: I9cb09bfc35f2b04567e52247f8bd1378910aeeb5
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 1e0aa2915f2d..2a33640cfc3c 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -844,7 +844,9 @@ static char *nameExtract( const sal_uInt8* name, int nTableSize, int n, int dbFl int len = GetUInt16(name+6, 12 * n + 8, 1); // sanity check - if( (len <= 0) || ((ptr+len) > (name+nTableSize)) ) + const sal_uInt8* end_table = name+nTableSize; + const int available_space = ptr > end_table ? 0 : (end_table - ptr); + if( (len <= 0) || len > available_space) { if( ucs2result ) *ucs2result = NULL; |