Browse Source

Fix the bug where length() does not dereference arrays

master
Gavin Howard 2 years ago
parent
commit
f3e5367e1f
Signed by untrusted user who does not match committer: gavin GPG Key ID: C08038BDF280D33E
  1. 12
      src/program.c

12
src/program.c

@ -1235,8 +1235,16 @@ static BcStatus bc_program_builtin(BcProgram *p, uchar inst) {
if (len) {
#if BC_ENABLED
if (BC_IS_BC && opd->t == BC_RESULT_ARRAY)
val = (BcBigDig) ((BcVec*) num)->len;
if (BC_IS_BC && opd->t == BC_RESULT_ARRAY) {
BcVec *v = (BcVec*) num;
if (v->size == sizeof(uchar)) v = bc_program_dereference(p, v);
assert(v->size == sizeof(BcNum));
val = (BcBigDig) v->len;
}
else
#endif // BC_ENABLED
{

Loading…
Cancel
Save