mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 09:24:55 +02:00
- fixed SF# 581: Out-of-bound array access in Unicode::properties() function.
This commit is contained in:
parent
c0f725b888
commit
12b0255f58
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Unicode.h
|
||||
//
|
||||
// $Id: //poco/1.4/Foundation/include/Poco/Unicode.h#1 $
|
||||
// $Id: //poco/1.4/Foundation/include/Poco/Unicode.h#2 $
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Text
|
||||
@ -188,6 +188,11 @@ public:
|
||||
UCP_VAI
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
UCP_MAX_CODEPOINT = 0x10FFFF
|
||||
};
|
||||
|
||||
struct CharacterProperties
|
||||
/// This structure holds the character properties
|
||||
/// of an Unicode character.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// Unicode.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/Foundation/src/Unicode.cpp#1 $
|
||||
// $Id: //poco/1.4/Foundation/src/Unicode.cpp#2 $
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Text
|
||||
@ -49,6 +49,7 @@ namespace Poco {
|
||||
|
||||
void Unicode::properties(int ch, CharacterProperties& props)
|
||||
{
|
||||
if (ch > UCP_MAX_CODEPOINT) ch = 0;
|
||||
const ucd_record* ucd = GET_UCD(ch);
|
||||
props.category = static_cast<CharacterCategory>(_pcre_ucp_gentype[ucd->chartype]);
|
||||
props.type = static_cast<CharacterType>(ucd->chartype);
|
||||
|
Loading…
x
Reference in New Issue
Block a user