Home Docs Tutorial Contributing Licenses Gallery

Welcome to Hyang Bugs Page

This page contains all bugs found or reported in each Hyang release since 1.2.1.

Bugs in Hyang 1.2.1

Here are the list of all bugs found or reported in Hyang 1.2.1. If you find a bug or would like to propose an improvement or a suggestion (patch) to fix the bugs, you can email bug reports to contributing@hyang.org.


Bug #12-1a

The format for function os.date may probably pass the format string. This bug does not actually happen in the usual abahyang compiler, but with an additional function memcmp as an "interceptor". Such a function continues reading memory after a difference is found.

Patch:

hyangoslib.c @ 264:

/* for (option = HYANG_STRFTIMEOPTIONS; *option != '\0'; option += oplen) { */
/* since 1.2.2 */
int convlen = (int)strlen(conv);
for (option = HYANG_STRFTIMEOPTIONS; *option != '\0' && oplen <= convlen; option += oplen) {

Bug #12-1b

The for loop with 4 or more expressions will next probably crash the Hyang interpreter. Example:

repeat until load "for w in m,n,o,p do local function f() end"

Patch:

hyangparser.c @ 327:

}
/* In Hyang 1.2.2 */
+ if (nexps > nvars)
+ ls->fs->freereg -= nexps - nvars; /* extra values, removed */
}

hyangparser.c @ 1162:

int nexps;
checknext(ls, '=');
nexps = explist(ls, &e);
/* Fixed in Hyang 1.2.2 */
/* if (nexps != nvars) { */
if (nexps != nvars)
adjust_assign(ls, nvars, nexps, &e);
/* if (nexps > nvars)
ls->fs->freereg -= nexps - nvars;
} */
else {
hyangK_setoneret(ls->fs, &e); /* close last expression */
hyangK_storevar(ls->fs, &lh->v, &e);

Bug #12-1c

Hyang can generate wrong codes in functions with too many constants.

Patch:

hyangcode.c @ 761:

static void codebinexpval (FuncState *fs, OpCode op,
expdesc *e1, expdesc *e2, int line) {

/* in 1.2.2 */
/* int rk1 = hyangK_exp2RK(fs, e1); */
/* int rk2 = hyangK_exp2RK(fs, e2); */

int rk2 = hyangK_exp2RK(fs, e2);
int rk1 = hyangK_exp2RK(fs, e1);
freeexps(fs, e1, e2);
e1->u.info = hyangK_codeABC(fs, op, 0, rk1, rk2);
e1->k = VRELOCABLE;
hyangK_fixline(fs, line);
}