... | ... |
@@ -1483,9 +1483,13 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc) |
1483 | 1483 |
gmap[j] = bc->numGlobalBytes; |
1484 | 1484 |
bc->numGlobalBytes += typesize(bc, ty); |
1485 | 1485 |
} |
1486 |
- bc->globalBytes = cli_calloc(1, bc->numGlobalBytes); |
|
1487 |
- if (!bc->globalBytes) |
|
1488 |
- return CL_EMEM; |
|
1486 |
+ if (bc->numGlobalBytes) { |
|
1487 |
+ bc->globalBytes = cli_calloc(1, bc->numGlobalBytes); |
|
1488 |
+ if (!bc->globalBytes) |
|
1489 |
+ return CL_EMEM; |
|
1490 |
+ } else |
|
1491 |
+ bc->globalBytes = NULL; |
|
1492 |
+ |
|
1489 | 1493 |
for (j=0;j<bc->num_globals;j++) { |
1490 | 1494 |
struct cli_bc_type *ty; |
1491 | 1495 |
if (bc->globaltys[j] < 65) |
... | ... |
@@ -264,7 +264,7 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack, |
264 | 264 |
#define uint_type(n) uint##n##_t |
265 | 265 |
#define READNfrom(maxBytes, from, x, n, p)\ |
266 | 266 |
CHECK_GT((maxBytes), (p)+(n/8)-1);\ |
267 |
- CHECK_EQ((p)&(n-1), 0);\ |
|
267 |
+ CHECK_EQ((p)&(n/8-1), 0);\ |
|
268 | 268 |
x = *(uint_type(n)*)&(from)[(p)];\ |
269 | 269 |
TRACE_R(x) |
270 | 270 |
|