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