durable_rules 2.0.23 → 2.0.28

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5220161e2cc19405339ce104109a5ab075b092d5
4
- data.tar.gz: 5e377d29c7c5d3985ddd8649b5abbf264f7d6612
3
+ metadata.gz: fd4b836b5afc54646b8214078c55d46acb9086fa
4
+ data.tar.gz: f1f76182fd9edad82893c4aeca5bc197cde019d7
5
5
  SHA512:
6
- metadata.gz: 0f86aca1a3edb8a690940bbbccd9802399174bc23c15bae438b95bde71bb9322374ee58caca508f1dc47dbfc25d5ea128d4479541b34645d16c4b20d577f9119
7
- data.tar.gz: 9304dd821caa413367edffa5e410bbf19f7a504ab06182796d7cdd2d8e1ad27454382968b64483a32757e968b50f20dbd616dd5028a6e7b4c2cd54f6e3f5d13c
6
+ metadata.gz: 6db4753a711a5f409fcab98c1b8f28be7e38e457814c70c6328d7797aa27ddf7f8a4b8386adfb54a764b5cda17b35189f18d5363bb430bec6062903b9ccc2669
7
+ data.tar.gz: 43ca66890ebe866a3a7e3071191633951f22b83cfe9912e22aac6373e56538af22f30c0daeecc4340c5f8668d08e36b2e2fafdd9bfabad8e5efc07fdf8dc4148
@@ -1083,7 +1083,7 @@ module Engine
1083
1083
 
1084
1084
  timer = Timers::Group.new
1085
1085
 
1086
- thread_lambda = -> c {
1086
+ thread_lambda = -> c, _t {
1087
1087
  if @ruleset_list.empty?
1088
1088
  timer.after 0.5, &thread_lambda
1089
1089
  else
@@ -1116,7 +1116,7 @@ module Engine
1116
1116
 
1117
1117
  timer = Timers::Group.new
1118
1118
 
1119
- thread_lambda = -> c {
1119
+ thread_lambda = -> c, _t {
1120
1120
  if @ruleset_list.empty?
1121
1121
  timer.after 0.5, &thread_lambda
1122
1122
  else
@@ -1587,7 +1587,7 @@ static unsigned int isArrayMatch(ruleset *tree,
1587
1587
  jsonProperty *currentProperty,
1588
1588
  alpha *arrayAlpha,
1589
1589
  unsigned char *propertyMatch) {
1590
-
1590
+ *propertyMatch = 0;
1591
1591
  unsigned int result = RULES_OK;
1592
1592
  if (currentProperty->type != JSON_ARRAY) {
1593
1593
  return RULES_OK;
@@ -132,6 +132,12 @@ unsigned int readNextArrayValue(char *start, char **first, char **last, unsigned
132
132
  }
133
133
  break;
134
134
  case ST_OBJECT_PROP_VAL:
135
+ if (start[0] == ']') {
136
+ *first = start;
137
+ *last = start;
138
+ return PARSE_END;
139
+ }
140
+
135
141
  return getValue(start, first, last, type);
136
142
  break;
137
143
  }
@@ -1260,7 +1260,7 @@ static unsigned int packGraph(state *start,
1260
1260
  for (int i = 0; i < currentState->transitionsLength; ++ i) {
1261
1261
  transition *currentTransition = &currentState->transitions[i];
1262
1262
  unsigned int currentTransitionSymbol = currentTransition->symbol;
1263
- if (caseInsensitive) {
1263
+ if (caseInsensitive && currentTransitionSymbol != REGEX_DOT) {
1264
1264
  currentTransitionSymbol = tolower(currentTransitionSymbol);
1265
1265
  }
1266
1266
 
@@ -59,6 +59,7 @@
59
59
  } while(0)
60
60
 
61
61
 
62
+ handleEntry handleEntries[MAX_HANDLES];
62
63
  unsigned int firstEmptyEntry = 1;
63
64
  unsigned int lastEmptyEntry = MAX_HANDLES -1;
64
65
  char entriesInitialized = 0;
@@ -33,6 +33,8 @@
33
33
  #define ERR_NO_ACTION_AVAILABLE 310
34
34
  #define ERR_PROPERTY_NOT_FOUND 311
35
35
  #define ERR_OPERATION_NOT_SUPPORTED 312
36
+ #define ERR_EVENT_MAX_OBJECT_SIZE 313
37
+ #define ERR_EVENT_MAX_OBJECT_PROPERTY_SIZE 314
36
38
  #define ERR_PARSE_REGEX 501
37
39
  #define ERR_REGEX_MAX_TRANSITIONS 502
38
40
  #define ERR_REGEX_MAX_STATES 503
@@ -64,7 +66,7 @@ typedef struct handleEntry {
64
66
  unsigned int nextEmptyEntry;
65
67
  } handleEntry;
66
68
 
67
- handleEntry handleEntries[MAX_HANDLES];
69
+ extern handleEntry handleEntries[MAX_HANDLES];
68
70
  extern unsigned int firstEmptyEntry;
69
71
  extern unsigned int lastEmptyEntry;
70
72
  extern char entriesInitialized;
@@ -1378,8 +1378,17 @@ unsigned int getObjectProperty(jsonObject *jo,
1378
1378
  unsigned int setObjectProperty(jsonObject *jo,
1379
1379
  unsigned int hash,
1380
1380
  unsigned char type,
1381
- unsigned short valueOffset,
1382
- unsigned short valueLength) {
1381
+ unsigned int valueOffset,
1382
+ unsigned int valueLength) {
1383
+
1384
+ if (valueLength >= MAX_OBJECT_PROPERTY_SIZE) {
1385
+ return ERR_EVENT_MAX_OBJECT_PROPERTY_SIZE;
1386
+ }
1387
+
1388
+ if (valueOffset >= (MAX_OBJECT_SIZE - MAX_OBJECT_PROPERTY_SIZE)) {
1389
+ return ERR_EVENT_MAX_OBJECT_SIZE;
1390
+ }
1391
+
1383
1392
  jsonProperty *property = &jo->properties[jo->propertiesLength];
1384
1393
  ++jo->propertiesLength;
1385
1394
  if (jo->propertiesLength == MAX_OBJECT_PROPERTIES) {
@@ -1,5 +1,5 @@
1
1
 
2
- #include <time.h>
2
+ #include <time.h>
3
3
 
4
4
  #define HASH_ID 926444256
5
5
  #define HASH_SID 3593476751
@@ -18,6 +18,8 @@
18
18
 
19
19
  #define UNDEFINED_HASH_OFFSET 0
20
20
  #define MAX_OBJECT_PROPERTIES 255
21
+ #define MAX_OBJECT_SIZE 4294967296
22
+ #define MAX_OBJECT_PROPERTY_SIZE 16777216
21
23
  #define MAX_MESSAGE_FRAMES 16
22
24
  #define MAX_MESSAGE_INDEX_LENGTH 512
23
25
  #define MAX_LEFT_FRAME_INDEX_LENGTH 512
@@ -64,8 +66,8 @@ typedef struct pool {
64
66
  typedef struct jsonProperty {
65
67
  unsigned int hash;
66
68
  unsigned char type;
67
- unsigned short valueOffset;
68
- unsigned short valueLength;
69
+ unsigned int valueOffset;
70
+ unsigned int valueLength;
69
71
  union {
70
72
  long long i;
71
73
  double d;
@@ -193,8 +195,8 @@ unsigned int getObjectProperty(jsonObject *jo,
193
195
  unsigned int setObjectProperty(jsonObject *jo,
194
196
  unsigned int hash,
195
197
  unsigned char type,
196
- unsigned short valueOffset,
197
- unsigned short valueLength);
198
+ unsigned int valueOffset,
199
+ unsigned int valueLength);
198
200
 
199
201
  unsigned int constructObject(char *root,
200
202
  char *parentName,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.23
4
+ version: 2.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-30 00:00:00.000000000 Z
11
+ date: 2020-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake