@@ -4783,15 +4783,17 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
47834783
47844784 UChar32 c;
47854785 U16_NEXT (inputBuf, fp->fInputIdx , fActiveLimit , c);
4786- if (c < 256 ) {
4787- Regex8BitSet &s8 = RegexStaticSets::gStaticSets ->fPropSets8 [opValue];
4788- if (s8.contains (c)) {
4789- success = !success;
4790- }
4791- } else {
4792- const UnicodeSet &s = RegexStaticSets::gStaticSets ->fPropSets [opValue];
4793- if (s.contains (c)) {
4794- success = !success;
4786+ if (c >= 0 ) {
4787+ if (c < 256 ) {
4788+ Regex8BitSet &s8 = RegexStaticSets::gStaticSets ->fPropSets8 [opValue];
4789+ if (s8.contains (c)) {
4790+ success = !success;
4791+ }
4792+ } else {
4793+ const UnicodeSet &s = RegexStaticSets::gStaticSets ->fPropSets [opValue];
4794+ if (s.contains (c)) {
4795+ success = !success;
4796+ }
47954797 }
47964798 }
47974799 if (!success) {
@@ -4815,15 +4817,17 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
48154817
48164818 UChar32 c;
48174819 U16_NEXT (inputBuf, fp->fInputIdx , fActiveLimit , c);
4818- if (c < 256 ) {
4819- Regex8BitSet &s8 = RegexStaticSets::gStaticSets ->fPropSets8 [opValue];
4820- if (s8.contains (c) == false ) {
4821- break ;
4822- }
4823- } else {
4824- const UnicodeSet &s = RegexStaticSets::gStaticSets ->fPropSets [opValue];
4825- if (s.contains (c) == false ) {
4826- break ;
4820+ if (c >= 0 ) {
4821+ if (c < 256 ) {
4822+ Regex8BitSet &s8 = RegexStaticSets::gStaticSets ->fPropSets8 [opValue];
4823+ if (s8.contains (c) == false ) {
4824+ break ;
4825+ }
4826+ } else {
4827+ const UnicodeSet &s = RegexStaticSets::gStaticSets ->fPropSets [opValue];
4828+ if (s.contains (c) == false ) {
4829+ break ;
4830+ }
48274831 }
48284832 }
48294833 fp = reinterpret_cast <REStackFrame*>(fStack ->popFrame (fFrameSize ));
@@ -4844,20 +4848,21 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
48444848 // There is input left. Pick up one char and test it for set membership.
48454849 UChar32 c;
48464850 U16_NEXT (inputBuf, fp->fInputIdx , fActiveLimit , c);
4847- if (c<256 ) {
4848- Regex8BitSet *s8 = &fPattern ->fSets8 [opValue];
4849- if (s8->contains (c)) {
4850- // The character is in the set. A Match.
4851- break ;
4852- }
4853- } else {
4854- UnicodeSet* s = static_cast <UnicodeSet*>(fSets ->elementAt (opValue));
4855- if (s->contains (c)) {
4856- // The character is in the set. A Match.
4857- break ;
4851+ if (c >= 0 ) {
4852+ if (c<256 ) {
4853+ Regex8BitSet *s8 = &fPattern ->fSets8 [opValue];
4854+ if (s8->contains (c)) {
4855+ // The character is in the set. A Match.
4856+ break ;
4857+ }
4858+ } else {
4859+ UnicodeSet* s = static_cast <UnicodeSet*>(fSets ->elementAt (opValue));
4860+ if (s->contains (c)) {
4861+ // The character is in the set. A Match.
4862+ break ;
4863+ }
48584864 }
48594865 }
4860-
48614866 // the character wasn't in the set.
48624867 fp = reinterpret_cast <REStackFrame*>(fStack ->popFrame (fFrameSize ));
48634868 }
0 commit comments