idx
int64 0
522k
| project
stringclasses 631
values | commit_id
stringlengths 7
40
| project_url
stringclasses 630
values | commit_url
stringlengths 4
164
| commit_message
stringlengths 0
11.5k
| target
int64 0
1
| func
stringlengths 5
484k
| func_hash
float64 1,559,120,642,045,605,000,000,000B
340,279,892,905,069,500,000,000,000,000B
| file_name
stringlengths 4
45
| file_hash
float64 25,942,829,220,065,710,000,000,000B
340,272,304,251,680,200,000,000,000,000B
⌀ | cwe
sequencelengths 0
1
| cve
stringlengths 4
16
| cve_desc
stringlengths 0
2.3k
| nvd_url
stringlengths 37
49
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
520,716 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_bxor() { JSI_NEW_CODES(0,OP_BXOR, 0); } | 291,529,472,261,680,300,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,717 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_array(jsi_Pstate *p, jsi_Pline *line, int c) { JSI_NEW_CODESLN(0,OP_ARRAY, c); } | 42,545,662,737,896,530,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,718 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static JSITHREADRET NewInterpThread(void* iPtr)
{
int rc = JSI_OK;
InterpObj *udf = (InterpObj *)iPtr;
Jsi_Interp *interp = udf->subinterp;
interp->threadId = Jsi_CurrentThread();
if (interp->scriptStr)
rc = Jsi_EvalString(interp, interp->scriptStr, 0);
else if (interp->scriptFile) {
if (!interp->debugOpts.debugCallback) // Debug will use Interp.source() instead.
Jsi_EvalFile(interp, interp->scriptFile, 0);
} else {
Jsi_LogBug("no eval");
}
if (rc != JSI_OK) {
Jsi_LogError("eval failure");
interp->threadErrCnt++;
if (Jsi_MutexLock(interp, interp->Mutex) != JSI_OK)
return NULL;
Jsi_MutexUnlock(interp, interp->Mutex);
}
interpObjErase(udf);
#ifndef __WIN32
/* TODO: should we wait/notify parent??? */
pthread_detach(pthread_self());
return NULL;
#endif
} | 111,345,293,004,673,100,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,719 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_push_null() { JSI_NEW_CODES(0,OP_PUSHNULL, 0); } | 2,208,185,719,158,500,300,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,720 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | int Jsi_HexStr(const uchar *data, int len, Jsi_DString *dStr, bool decode) {
int olen = (decode?(len/2+1):(len*2+1));
Jsi_DSSetLength(dStr, olen);
if (!decode)
return jsi_FromHexStr((const char*)data, (uchar*)Jsi_DSValue(dStr));
jsi_ToHexStr((const uchar*)data, len, Jsi_DSValue(dStr));
return olen-1;
} | 10,190,539,951,959,384,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,721 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_ListEntry* Jsi_ListSearchFirst (Jsi_List *list, Jsi_ListSearch *searchPtr, int flags)
{
SIGASSERT(list, LIST);
searchPtr->flags = flags;
Jsi_ListEntry *lptr;
if (flags & JSI_LIST_REVERSE) {
lptr = Jsi_ListGetBack(list);
searchPtr->nextEntryPtr = (lptr?Jsi_ListEntryPrev(lptr):NULL);
} else {
lptr = Jsi_ListGetFront(list);
searchPtr->nextEntryPtr = (lptr?Jsi_ListEntryNext(lptr):NULL);
}
return lptr;
} | 171,983,557,350,033,570,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,722 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_TreeEntry *Jsi_TreeSet(Jsi_Tree *treePtr, const void *key, void *value)
{
Jsi_TreeEntry *hPtr;
bool isNew;
hPtr = Jsi_TreeEntryNew(treePtr, key, &isNew);
if (!hPtr) return hPtr;
Jsi_TreeValueSet(hPtr, value);
return hPtr;
} | 300,772,393,565,603,200,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,723 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void* Jsi_MapGet(Jsi_Map *mapPtr, const void *key, int flags){
SIGASSERT(mapPtr, MAP);
switch (mapPtr->typ) {
case JSI_MAP_HASH: return Jsi_HashGet(mapPtr->v.hash, (void*)key, flags);
case JSI_MAP_TREE: return Jsi_TreeGet(mapPtr->v.tree, (void*)key, flags);
case JSI_MAP_LIST: {
Jsi_ListEntry* lptr = (key == NULL? Jsi_ListGetFront(mapPtr->v.list) : Jsi_ListGetBack(mapPtr->v.list));
if (lptr)
return Jsi_ListValueGet(lptr);
break;
}
case JSI_MAP_NONE: break;
}
return NULL;
} | 89,771,120,791,216,130,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,724 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void *Jsi_StackHead(Jsi_Stack *stack)
{
if (stack->len == 0)
return NULL;
return stack->vector[0];
} | 298,384,298,795,704,930,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,725 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void *Jsi_CommandNewObj(Jsi_Interp *interp, const char *name, const char *arg1, const char *opts, const char *var) {
char buf[JSI_BUFSIZ];
if (arg1)
snprintf(buf, sizeof(buf), "%s%snew %s('%s', %s);", var?var:"", var?"=":"return ", name, arg1, opts?opts:"null");
else
snprintf(buf, sizeof(buf), "%s%snew %s(%s);", var?var:"", var?"=":"return ", name, opts?opts:"null");
int rc = Jsi_EvalString(interp, buf, 0);
if (rc != JSI_OK)
return NULL;
Jsi_Value *vObj = interp->retValue;
if (var)
vObj = Jsi_NameLookup(interp, var);
if (!vObj)
return NULL;
return Jsi_UserObjGetData(interp, vObj, NULL);
} | 282,722,714,309,117,800,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,726 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_GetIndex( Jsi_Interp *interp, const char *str,
const char **tablePtr, const char *msg, int flags,
int *indexPtr)
{
const char *msg2 = "unknown ";
char **cp, *c;
int cond, index = -1, slen, i, dup = 0;
int exact = (flags & JSI_CMP_EXACT);
int nocase = (flags & JSI_CMP_NOCASE);
slen = Jsi_Strlen(str);
/* if (slen==0)
return Jsi_LogError("empty option %s %s", msg, str);*/
cp = (char**)tablePtr;
i = -1;
while (*cp != 0) {
i++;
c = *cp;
if (c[0] != str[0]) { cp++; continue; }
if (!nocase)
cond = (exact ? Jsi_Strcmp(c,str) : Jsi_Strncmp(c,str,slen));
else {
cond = (exact ? Jsi_Strncasecmp(c,str, -1) : Jsi_Strncasecmp(c,str,slen));
}
if (cond == 0) {
if (index<0) {
index = i;
} else {
dup = 1;
break;
}
}
cp++;
}
if (index >= 0 && dup == 0) {
*indexPtr = index;
return JSI_OK;
}
if (exact && (dup || index<=0)) {
if (interp != NULL) {
msg2 = (index>=0? "unknown ":"duplicate ");
}
goto err;
}
cp = (char**)tablePtr;
i = -1;
dup = 0;
index = -1;
while (*cp != 0) {
i++;
c = *cp;
if (c[0] == str[0] && Jsi_Strncmp(c,str, slen) == 0) {
if (index<0) {
index = i;
if (slen == (int)Jsi_Strlen(c))
break;
} else {
if (interp != NULL) {
msg2 = "ambiguous ";
}
goto err;
}
}
cp++;
}
if (index >= 0 && dup == 0) {
*indexPtr = index;
return JSI_OK;
}
err:
if (interp != NULL) {
Jsi_DString dStr = {};
Jsi_DSAppend(&dStr, msg2, msg, " \"", str, "\" not one of: ", NULL);
cp = (char**)tablePtr;
while (*cp != 0) {
c = *cp;
Jsi_DSAppend(&dStr, c, NULL);
Jsi_DSAppend(&dStr, " ", NULL);
cp++;
}
Jsi_LogError("%s", Jsi_DSValue(&dStr));
Jsi_DSFree(&dStr);
}
return JSI_ERROR;
} | 309,567,019,105,042,700,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,727 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static bool jsi_wswebsocketObjEqual(void *data1, void *data2)
{
return (data1 == data2);
} | 250,381,341,772,053,500,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,728 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OptionSpec * jsi_GetCachedOptionSpecs(Jsi_Interp *interp, const Jsi_OptionSpec *staticSpecs)
{
Jsi_OptionSpec *cachedSpecs;
Jsi_Hash *specCacheTablePtr;
Jsi_HashEntry *entryPtr;
bool isNew;
specCacheTablePtr = (Jsi_Hash*)Jsi_InterpGetData(interp, "jsi:OptionSpec", NULL);
if (specCacheTablePtr == NULL) {
specCacheTablePtr = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, 0);
Jsi_InterpSetData(interp, "jsi:OptionSpec", specCacheTablePtr, jsi_DeleteSpecCacheTable);
}
entryPtr = Jsi_HashEntryNew(specCacheTablePtr, (char *) staticSpecs, &isNew);
if (isNew) {
unsigned int entrySpace = sizeof(Jsi_OptionSpec);
const Jsi_OptionSpec *staticSpecPtr;
for (staticSpecPtr=staticSpecs; staticSpecPtr->id>=JSI_OPTION_BOOL && staticSpecPtr->id!=JSI_OPTION_END; staticSpecPtr++)
entrySpace += sizeof(Jsi_OptionSpec);
assert(staticSpecPtr->id==JSI_OPTION_END);
cachedSpecs = (Jsi_OptionSpec *) Jsi_Malloc(entrySpace);
memcpy((void *) cachedSpecs, (void *) staticSpecs, entrySpace);
Jsi_HashValueSet(entryPtr, cachedSpecs);
} else {
cachedSpecs = (Jsi_OptionSpec *) Jsi_HashValueGet(entryPtr);
}
return cachedSpecs;
} | 189,155,488,899,863,800,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,729 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_ScopeStrs *jsi_argInsert(jsi_Pstate *pstate, Jsi_ScopeStrs *a, const char *name, Jsi_Value *defValue, jsi_Pline *lPtr, bool prepend)
{
Jsi_Interp *interp = pstate->interp;
if (!a)
a = jsi_ScopeStrsNew();
pstate->args = a;
int atyp = pstate->argType;
if (defValue) {
int vt = defValue->vt;
if (vt == JSI_VT_NULL)
vt = JSI_TT_NULL;
else if (vt == JSI_VT_UNDEF && defValue->d.num==1)
vt = JSI_TT_VOID;
else if (vt == JSI_VT_OBJECT && defValue->d.obj->ot==JSI_OT_STRING)
vt = JSI_TT_STRING;
else
vt = (1<<defValue->vt);
atyp |= vt;
}
jsi_ScopeStrsPush(interp, a, name, atyp);
pstate->argType = 0;
a->args[a->count-1].defValue = defValue;
a->argCnt++;
if (prepend) {
jsi_ArgValue t;
int i, end = a->argCnt-1;
t = a->args[end];
for (i=end-1; i>=0; i--)
a->args[i+1]=a->args[i];
a->args[0] = t;
}
jsi_Pline *opl = interp->parseLine;
interp->parseLine = lPtr;
if (defValue) {
Jsi_IncrRefCount(interp, defValue);
if (a->firstDef==0)
a->firstDef = a->argCnt;
if (atyp)
jsi_ArgTypeCheck(interp, atyp, defValue, "default value", name, a->argCnt, NULL, 1);
} else {
if (a->firstDef && (interp->typeCheck.run || interp->typeCheck.all) )
Jsi_LogWarn("expected default value in argument list: \"%s\"", name);
}
interp->parseLine = opl;
return a;
} | 264,475,541,398,921,140,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,730 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC Jsi_JSONParseFmt(Jsi_Interp *interp, Jsi_Value **ret, const char *fmt, ...)
{
va_list argList;
uint n;
char buf[JSI_BUFSIZ], *cp = buf;
Jsi_DString dStr = {};
va_start(argList, fmt);
n = vsnprintf(buf, sizeof(buf), fmt, argList);
if (n>JSI_MAX_ALLOC_BUF) {
Jsi_LogError("Jsi_JSONParseFmt error: rc = %d", n);
va_end(argList);
return JSI_ERROR;
}
if (n >= sizeof(buf)) {
uint m;
Jsi_DSSetLength(&dStr, n+1);
m = vsnprintf(Jsi_DSValue(&dStr), n+1, fmt, argList);
assert(m == n);
JSI_NOWARN(m);
cp = Jsi_DSValue(&dStr);
}
va_end(argList);
return Jsi_JSONParse(interp, cp, ret, 0);
} | 318,826,636,506,782,050,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,731 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void Jsi_HashValueSet(Jsi_HashEntry *h, void *value)
{
h->clientData = value;
} | 90,787,475,961,921,030,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,732 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void jsi_FuncObjFree(Jsi_FuncObj *fobj)
{
if (fobj->scope)
jsi_ScopeChainFree(fobj->interp, fobj->scope);
if (fobj->bindArgs)
Jsi_DecrRefCount(fobj->interp, fobj->bindArgs);
if (fobj->bindFunc)
Jsi_DecrRefCount(fobj->interp, fobj->bindFunc);
if (fobj->func)
jsi_FuncFree(fobj->interp, fobj->func);
_JSI_MEMCLEAR(fobj);
Jsi_Free(fobj);
} | 35,684,411,311,634,350,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,733 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static bool mysqlObjIsTrue(void *data)
{
MySqlObj *jdb = (MySqlObj*)data;
SQLSIGASSERT(jdb,DB);
if (!jdb->db) return 0;
else return 1;
} | 281,457,144,820,295,230,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,734 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_ValueToBitfield(Jsi_Interp *interp, Jsi_OptionSpec* spec, Jsi_Value *inValue,
const char *inStr, void *record, Jsi_Wide flags)
{
Jsi_csgset *bsget = spec->init.OPT_BITS;
Jsi_Interp *d = interp;
int idx = spec->idx;
uchar *data = (uchar*)record;
Jsi_Number num;
Jsi_OptionSpec* enumSpec = (typeof(enumSpec))spec->data;
if (!d || !bsget || idx<0)
return Jsi_LogBug("invalid bitfield");
if (enumSpec) {
struct numStruct { int64_t numVal; } nval = {};
Jsi_OptionSpec eSpec[] = {
JSI_OPT(CUSTOM, typeof(nval), numVal, .help=spec->help, .flags=JSI_OPT_ENUM_SPEC,
.custom=Jsi_Opt_SwitchEnum, .data=(void*)enumSpec, .info=0, .tname=spec->tname, .value=0, .bits=0, .boffset=8*sizeof(int64_t) ),
JSI_OPT_END(typeof(nval))
};
if (JSI_OK != jsi_ValueToEnum(interp, eSpec, inValue, inStr, (void*)&nval, flags))
return JSI_ERROR;
num = (Jsi_Number)nval.numVal;
} else if (inStr) {
if (Jsi_GetDouble(interp, inStr, &num) != JSI_OK)
return JSI_ERROR;
} else {
if (inValue && !Jsi_ValueIsNumber(interp, inValue))
return JSI_ERROR;
Jsi_ValueGetNumber(interp, inValue, &num);
}
int64_t inum = (int64_t)num;
return (*bsget)(interp, data, &inum, spec, idx, 1);
} | 25,280,982,417,140,540,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,735 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void dbCollateNeeded(
void *cd,
sqlite3 *db,
int enc,
const char *zName
) {
int rc;
Jsi_Db *jdb = (Jsi_Db*)cd;
Jsi_Interp *interp = jdb->interp;
Jsi_Value *vpargs, *items[2], *ret;
items[0] = Jsi_ValueNewObj(interp, jdb->fobj);
items[1] = Jsi_ValueMakeStringDup(interp, NULL, zName);
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, items, 2, 0));
Jsi_IncrRefCount(interp, vpargs);
ret = Jsi_ValueNew1(interp);
rc = Jsi_FunctionInvoke(interp, jdb->onNeedCollate, vpargs,& ret, NULL);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK)
jdb->errCnt++;
} | 147,242,429,669,870,600,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,736 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static int StringCompare(Jsi_Tree *treePtr, const void *key1, const void *key2)
{
return Jsi_DictionaryCompare((char*)key1, (char*)key2);
//return Jsi_Strcmp((char*)key1, (char*)key2);
} | 273,978,679,511,200,940,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,737 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_TreeEntry *TreeArrayCreate(Jsi_Tree *treePtr, const void *key, bool *newPtr)
{
Jsi_TreeEntry *hPtr;
size_t size;
if ((hPtr = Jsi_TreeEntryFind(treePtr, key))) {
if (newPtr)
*newPtr = 0;
return hPtr;
}
if (newPtr)
*newPtr = 1;
size = sizeof(Jsi_TreeEntry) + treePtr->keyType; /*- sizeof(jsi_TreeKey);*/
hPtr = (Jsi_TreeEntry*)Jsi_Calloc(1,size);
SIGINIT(hPtr,TREEENTRY);
hPtr->typ = JSI_MAP_TREE;
hPtr->treePtr = treePtr;
hPtr->value = 0;
memcpy(hPtr->key.string, key, treePtr->keyType);
treePtr->numEntries++;
return hPtr;
} | 19,966,684,056,106,176,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,738 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void jsi_InteractiveSignal(int sig){
if (jsi_interactiveInterp)
jsi_interactiveInterp->interrupted = 1;
} | 228,198,633,657,139,400,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,739 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | int Jsi_Write(Jsi_Interp *interp, Jsi_Channel chan, const char *bufPtr, int slen) {
if (chan->fsPtr==0 || !chan->fsPtr->writeProc) return -1;
return chan->fsPtr->writeProc(chan, bufPtr, slen);
} | 226,961,309,356,925,870,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,740 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Interp *jsi_DoExit(Jsi_Interp *interp, int rc)
{
if (rc<0 || rc>127) rc = 127;
if (!interp || !interp->opts.no_exit) {
if (rc) {
Jsi_Flush(interp, jsi_Stdout);
Jsi_Flush(interp, jsi_Stderr);
}
exit(rc);
}
fprintf(stderr, "ignoring attempted exit: may cause a crash\n");
if (interp) interp->deleting = 1;
return NULL;
} | 230,810,526,163,357,400,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,741 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Interp* Jsi_Main(Jsi_InterpOpts *opts)
{
Jsi_RC rc = JSI_OK;
Jsi_Interp* interp = NULL;
int argc = 0, first = 1;
char **argv = NULL;
if (opts) {
interp = opts->interp;
argc = opts->argc;
argv = opts->argv;
}
if (!interp)
interp = Jsi_InterpNew(opts);
if (!interp)
return NULL;
Jsi_InterpOnDelete(interp, &jsi_InterpDelete, (void*)&jsi_InterpDelete);
argc -= interp->iskips;
argv += interp->iskips;
#ifndef NO_JAZ
/* Mount zip at end of executable */
Jsi_Value *v = Jsi_Executable(interp);
const char *exeFile = (v?Jsi_ValueString(interp, v, NULL):NULL);
int jsFound = 0;
if (v && (argc != 2 || Jsi_Strcmp(argv[1], "--nozvfs"))) {
rc = Jsi_EvalZip(interp, exeFile, JSI_ZVFS_DIR, &jsFound);
if (rc == JSI_OK) {
interp->selfZvfs = 1;
if (!jsFound) {
#if (JSI__FILESYS && JSI__ZVFS)
fprintf(stderr, "warning: no main.jsi or autoload.jsi\n");
#endif
}
if (jsi_deleted)
return jsi_DoExit(interp, jsi_exitCode);
else if (rc != 0) {
fprintf(stderr, "Error\n");
return jsi_DoExit(interp, 1);
}
}
}
#endif
const char *ext = NULL, *ai1, *iext = (argc<=1?NULL:Jsi_Strrchr(argv[1], '.'));
if (interp->selfZvfs && iext && Jsi_Strcmp(iext,".fossil")==0) {
rc = Jsi_EvalString(interp, "runModule('Archive');", JSI_EVAL_ISMAIN);
goto done;
}
Jsi_ShiftArgs(interp, NULL);
if (argc <= 1) {
if (interp->opts.no_interactive && !interp->interactive)
return interp;
rc = Jsi_Interactive(interp, JSI_OUTPUT_QUOTE|JSI_OUTPUT_NEWLINES);
goto done;
}
ai1 = argv[1];
if ((!Jsi_Strcmp(ai1, "-help") || !Jsi_Strcmp(ai1, "-h")) && argc<=3) {
if (argc>2) {
if (Jsi_PkgRequire(interp, "Help", 0)>=0) {
char tbuf[BUFSIZ];
snprintf(tbuf, sizeof(tbuf), "return runModule('Help', '%s'.trim().split(null));", argv[2]);
Jsi_RC rc = Jsi_EvalString(interp, tbuf, 0);
const char *hstr = Jsi_ValueToString(interp, interp->retValue, NULL);
if (rc == JSI_OK)
puts(hstr);
return jsi_DoExit(interp, 1);
}
}
dohelp:
puts("USAGE:\n jsish [PREFIX-OPTS] [COMMAND-OPTS|FILE] ...\n"
"\nPREFIX-OPTS:\n"
" --C FILE\tOption file of config options.\n"
" --F\t\tTrace all function calls and returns.\n"
" --I OPT:VAL\tInterp option: equivalent to Interp.conf({OPT:VAL}).\n"
" --L PATH\tSet safeMode to \"lockdown\" using PATH for safe(Read/Write)Dirs.\n"
" --T OPT\tTypecheck option: equivalent to \"use OPT\".\n"
" --U\t\tDisplay unittest output, minus pass/fail compare.\n"
" --V\t\tSame as --U, but adds file and line number to output.\n"
"\nCOMMAND-OPTS:\n"
" -a\t\tArchive: mount an archive (zip, sqlar or fossil repo) and run module.\n"
" -c\t\tCData: generate .c or JSON output from a .jsc description.\n"
" -d\t\tDebug: console script debugger.\n"
" -e CODE ...\tEvaluate javascript CODE.\n"
" -g\t\tGendeep: generate html output from markdeep source.\n"
" -h ?CMD?\tHelp: show help for jsish or its commands.\n"
" -m\t\tModule: utility create/manage/invoke a Module.\n"
" -s\t\tSafe: runs script in safe sub-interp.\n"
" -u\t\tUnitTest: test script file(s) or directories .js/.jsi files.\n"
" -w\t\tWget: web client to download file from url.\n"
" -v\t\tVersion: show version detail: add an arg to show only X.Y.Z\n"
" -z\t\tZip: append/manage zip files at end of executable.\n"
" -D\t\tDebugUI: web-gui script debugger.\n"
" -J\t\tJSpp: preprocess javascript for web.\n"
" -S\t\tSqliteUI: web-gui for sqlite database file.\n"
" -W\t\tWebsrv: web server to serve out content.\n"
"\nInterp options may also be set via the confFile.'\n"
);
return jsi_DoExit(interp, 1);
}
if (!Jsi_Strcmp(ai1, "-version"))
ai1 = "-v";
if (ai1[0] == '-') {
switch (ai1[1]) {
case 'a':
rc = Jsi_EvalString(interp, "runModule('Archive');", JSI_EVAL_ISMAIN);
break;
case 'c':
rc = Jsi_EvalString(interp, "runModule('Cdata');", JSI_EVAL_ISMAIN);
break;
case 'd':
interp->debugOpts.isDebugger = 1;
rc = Jsi_EvalString(interp, "runModule('Debug');", JSI_EVAL_ISMAIN);
break;
case 'D':
interp->debugOpts.isDebugger = 1;
rc = Jsi_EvalString(interp, "runModule('DebugUI');", JSI_EVAL_ISMAIN);
break;
case 'e':
if (argc < 3)
rc = Jsi_LogError("missing argument");
else {
rc = Jsi_EvalString(interp, argv[2], JSI_EVAL_ISMAIN|JSI_EVAL_NOSKIPBANG);
if (rc == JSI_OK && argc>3) {
first += 2;
Jsi_ShiftArgs(interp, NULL);
Jsi_ShiftArgs(interp, NULL);
goto dofile;
}
}
break;
case 'g':
rc = Jsi_EvalString(interp, "runModule('GenDeep');", JSI_EVAL_ISMAIN);
break;
case 'h':
goto dohelp;
case 'J':
rc = Jsi_EvalString(interp, "runModule('Jspp');", JSI_EVAL_ISMAIN);
break;
case 'm':
if (argc <= 2 || argv[2][0] == '-')
rc = Jsi_EvalString(interp, "runModule('Module');", JSI_EVAL_ISMAIN);
else {
Jsi_DString dStr = {}, eStr = {};
const char *cps, *cpe;
cps = Jsi_Strrchr(argv[2], '/');
if (cps) cps++; else cps = argv[2];
cpe = Jsi_Strrchr(cps, '.');
int len = (cpe?cpe-cps:(int)Jsi_Strlen(cps));
if (cpe)
Jsi_DSPrintf(&dStr, "source(\"%s\");", argv[2]);
else
Jsi_DSPrintf(&dStr, "require(\"%s\");", argv[2]);
Jsi_DSPrintf(&dStr, "puts(runModule(\"%.*s\",console.args.slice(1)));", len, cps);
rc = Jsi_EvalString(interp, Jsi_DSValue(&dStr), JSI_EVAL_NOSKIPBANG);
Jsi_DSFree(&dStr);
Jsi_DSFree(&eStr);
}
break;
case 's':
rc = Jsi_EvalString(interp, "runModule('Safe');", JSI_EVAL_ISMAIN);
break;
case 'S':
rc = Jsi_EvalString(interp, "runModule('SqliteUI');", JSI_EVAL_ISMAIN);
break;
case 'u':
rc = Jsi_EvalString(interp, "exit(runModule('UnitTest'));", JSI_EVAL_ISMAIN);
break;
case 'v': {
char str[200] = "\n";
Jsi_Value* fval = Jsi_ValueNewStringKey(interp, "/zvfs/lib/sourceid.txt");
if (!Jsi_Access(interp, fval, R_OK)) {
Jsi_Channel chan = Jsi_Open(interp, fval, "r");
if (chan)
Jsi_Read(interp, chan, str, sizeof(str));
}
if (argc>2)
printf("%u.%u.%u\n", JSI_VERSION_MAJOR, JSI_VERSION_MINOR, JSI_VERSION_RELEASE);
else
printf("%u.%u.%u %." JSI_VERFMT_LEN JSI_NUMGFMT " %s", JSI_VERSION_MAJOR, JSI_VERSION_MINOR, JSI_VERSION_RELEASE, Jsi_Version(), str);
return jsi_DoExit(interp, 1);
}
case 'w':
rc = Jsi_EvalString(interp, "runModule('Wget');", JSI_EVAL_ISMAIN);
break;
case 'W':
rc = Jsi_EvalString(interp, "runModule('Websrv');", JSI_EVAL_ISMAIN);
break;
case 'z':
rc = Jsi_EvalString(interp, "runModule('Zip');", JSI_EVAL_ISMAIN);
break;
default:
puts("usage: jsish [ --C FILE | --I OPT:VAL | --L PATH | --T OPT | --U | --V | --F ] | -e STRING |\n\t"
"| -a | -c | -d | -D | -h | -m | -s | -S | -u | -v | -w | -W | -z | FILE ...\nUse -help for long help.");
return jsi_DoExit(interp, 1);
}
} else {
dofile:
ext = Jsi_Strrchr(argv[first], '.');
/* Support running "main.jsi" from a zip file. */
if (ext && (Jsi_Strcmp(ext,".zip")==0 ||Jsi_Strcmp(ext,".jsz")==0 ) ) {
rc = Jsi_EvalZip(interp, argv[first], NULL, &jsFound);
if (rc<0) {
fprintf(stderr, "zip mount failed\n");
return jsi_DoExit(interp, 1);
}
if (!(jsFound&JSI_ZIP_MAIN)) {
fprintf(stderr, "main.jsi not found\n");
return jsi_DoExit(interp, 1);
}
} else if (ext && !Jsi_Strcmp(ext,".jsc")) {
Jsi_DString dStr = {};
Jsi_DSPrintf(&dStr, "console.args.unshift('%s'); runModule('CData');", argv[first]);
rc = Jsi_EvalString(interp, Jsi_DSValue(&dStr), JSI_EVAL_ISMAIN|JSI_EVAL_NOSKIPBANG);
Jsi_DSFree(&dStr);
} else {
if (argc>1) {
jsi_vf = Jsi_ValueNewStringKey(interp, argv[first]);
Jsi_IncrRefCount(interp, jsi_vf);
}
rc = Jsi_EvalFile(interp, jsi_vf, JSI_EVAL_ARGV0|JSI_EVAL_AUTOINDEX|JSI_EVAL_ISMAIN);
if (jsi_vf) {
Jsi_DecrRefCount(interp, jsi_vf);
jsi_vf = NULL;
}
}
}
if (jsi_deleted) //TODO: rationalize jsi_deleted, jsi_exitCode, etc
return jsi_DoExit(rc==JSI_EXIT?NULL:interp, jsi_exitCode);
if (rc == JSI_OK) {
/* Skip output from an ending semicolon which evaluates to undefined */
Jsi_Value *ret = Jsi_ReturnValue(interp);
if (!Jsi_ValueIsType(interp, ret, JSI_VT_UNDEF)) {
Jsi_DString dStr = {};
fputs(Jsi_ValueGetDString(interp, ret, &dStr, 0), stdout);
Jsi_DSFree(&dStr);
fputs("\n", stdout);
}
} else {
if (!interp->parent && !interp->isHelp)
fprintf(stderr, "ERROR: %s\n", interp->errMsgBuf);
return jsi_DoExit(interp, 1);
}
done:
if (rc == JSI_EXIT) {
if (opts)
opts->exitCode = jsi_exitCode;
return NULL;
}
if (jsi_deleted == 0 && interp->opts.auto_delete) {
Jsi_InterpDelete(interp);
return NULL;
}
return interp;
} | 209,247,186,604,716,360,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,742 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC Jsi_ListConf(Jsi_List *listPtr, Jsi_MapOpts *opts, bool set)
{
if (set) {
listPtr->opts = *opts;
} else {
*opts = listPtr->opts;
}
return JSI_OK;
} | 229,744,314,003,058,840,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,743 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void dbRollbackHandler(void *cd) {
Jsi_Db *jdb = (Jsi_Db*)cd;
Jsi_Interp *interp = jdb->interp;
Jsi_Value *vpargs, *items[2] = {}, *ret = Jsi_ValueNew1(interp);
items[0] = Jsi_ValueNewObj(interp, jdb->fobj);
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, items, 1, 0));
Jsi_IncrRefCount(interp, vpargs);
Jsi_FunctionInvoke(interp, jdb->onRollback, NULL, &ret, NULL);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
} | 294,713,678,613,251,640,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,744 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static char * jsi_FSGetsProc(Jsi_Channel chan, char *s, int size) {
return fgets(s, size, _JSI_GETFP(chan,1));
} | 194,193,534,257,230,040,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,745 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void jsiPush(Jsi_Interp* interp, int n) {
int i = 0;
do {
if (!_jsi_STACKIDX(interp->framePtr->Sp))
_jsi_STACKIDX(interp->framePtr->Sp) = Jsi_ValueNew1(interp);
if (!_jsi_THISIDX(interp->framePtr->Sp))
_jsi_THISIDX(interp->framePtr->Sp) = Jsi_ValueNew1(interp);
if (i++ >= n) break;
interp->framePtr->Sp++;
} while (1);
} | 114,742,227,829,823,300,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,746 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Value* Jsi_ValueMakeString(Jsi_Interp *interp, Jsi_Value **vPtr, const char *s) {
return Jsi_ValueMakeBlob(interp, vPtr, (unsigned char *)s, Jsi_Strlen(s));
} | 289,050,586,582,637,000,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,747 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static int dbProgressHandler(void *cd) {
Jsi_Db *jdb = (Jsi_Db*)cd;
Jsi_Value *vpargs, *items[3] = {}, *ret;
Jsi_Interp *interp = jdb->interp;
items[0] = Jsi_ValueNewObj(interp, jdb->fobj);
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, items, 1, 0));
Jsi_IncrRefCount(interp, vpargs);
ret = Jsi_ValueNew1(interp);
int rc = Jsi_FunctionInvoke(interp, jdb->onProgress, vpargs, &ret, NULL);
if( JSI_OK!=rc ) {
jdb->errCnt++;
rc = 1;
} else
rc = dbGetIntBool(interp, ret);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
return rc;
} | 44,245,079,838,701,580,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,748 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC freeBindObjTbl(Jsi_Interp *interp, Jsi_HashEntry *hPtr, void *ptr) {
Jsi_Obj *v = (Jsi_Obj *)ptr;
if (!v) return JSI_OK;
SIGASSERT(v,OBJ);
if (v->ot != JSI_OT_FUNCTION)
fprintf(stderr, "invalid func obj\n");
else if (v->d.fobj && v->d.fobj->scope) {
v->d.fobj->scope = NULL;
}
Jsi_ObjDecrRefCount(interp, v);
return JSI_OK;
} | 129,364,980,498,711,650,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,749 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | bool Jsi_ValueIsObjType(Jsi_Interp *interp, Jsi_Value *v, Jsi_otype otype)
{
if (v == NULL || v->vt != JSI_VT_OBJECT)
return 0;
if (otype != JSI_OT_ARRAY)
return (v->d.obj->ot == otype);
if (v->d.obj->ot != JSI_OT_OBJECT || !v->d.obj->isarrlist)
return 0;
return 1;
} | 314,515,975,546,880,650,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,750 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_OptionsDup(Jsi_Interp *interp, const Jsi_OptionSpec *staticSpecs)
{
unsigned int entrySpace = sizeof(Jsi_OptionSpec);
const Jsi_OptionSpec *staticSpecPtr;
Jsi_OptionSpec *newSpecs;
for (staticSpecPtr=staticSpecs; staticSpecPtr->id>=JSI_OPTION_BOOL && staticSpecPtr->id<JSI_OPTION_END && staticSpecPtr->name;
staticSpecPtr++) {
entrySpace += sizeof(Jsi_OptionSpec);
}
newSpecs = (Jsi_OptionSpec *) Jsi_Malloc(entrySpace);
memcpy((void *) newSpecs, (void *) staticSpecs, entrySpace);
return newSpecs;
} | 132,710,702,958,971,100,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,751 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_wsfreeHandlers(Jsi_Interp *interp, Jsi_HashEntry* hPtr, void *ptr) {
jsi_wsHander *h = (jsi_wsHander*)ptr;
if (!h)
return JSI_OK;
if (h->val)
Jsi_DecrRefCount(interp, h->val);
if (h->objVar)
Jsi_DecrRefCount(interp, h->objVar);
Jsi_Free(h);
return JSI_OK;
} | 194,691,658,353,881,180,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,752 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_Filesystem *jsi_FilesysFind(const char *name)
{
FSList *fsPtr = jsiFSList;
while (fsPtr != NULL) {
if (!Jsi_Strcmp(fsPtr->fsPtr->typeName, name))
return fsPtr->fsPtr;
fsPtr = fsPtr->next;
}
return NULL;
} | 247,977,916,340,621,400,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,753 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | const char *jsi_DbOptionTypeStr(Jsi_OptionId typ, bool cname)
{
const Jsi_OptionTypedef* ti = Jsi_OptionTypeInfo(typ);
if (ti)
return (cname?ti->cName:ti->idName);
return NULL;
} | 183,462,269,716,593,430,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,754 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | int Jsi_OptionsChanged(Jsi_Interp *interp, Jsi_OptionSpec *spec, const char *pattern, ...)
{
va_list argList;
Jsi_OptionSpec *specPtr;
const char *option = pattern;
int cnt = 0;
va_start(argList, pattern);
spec = jsi_GetCachedOptionSpecs(interp, spec);
do {
for (specPtr = spec; specPtr->id>=JSI_OPTION_BOOL && specPtr->id < JSI_OPTION_END; specPtr++) {
if ((Jsi_GlobMatch(option, specPtr->name, 0)) &&
(specPtr->flags & JSI_OPT_IS_SPECIFIED)) {
cnt++;
}
}
assert(specPtr->id == JSI_OPTION_END);
} while ((option = va_arg(argList, char *)) != NULL);
va_end(argList);
return cnt;
} | 296,261,341,140,320,770,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,755 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC FilesysOpenCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
UdfGet(udf, _this, funcPtr);
if (try_open_file(interp, udf, args) != JSI_OK) {
Jsi_ValueMakeBool(interp, ret, 0);
}
Jsi_ValueMakeBool(interp, ret, 1);
return JSI_OK;
} | 109,255,449,897,913,860,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,756 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC MySqlConfCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
MySqlObj *jdb;
if (!(jdb = _mysql_getDbHandle(interp, _this, funcPtr))) return JSI_ERROR;
int oms = jdb->maxStmts;
const char *oldu = jdb->user, *oldpw = jdb->password, *olddb = jdb->database;
Jsi_RC rc = Jsi_OptionsConf(interp, SqlOptions, jdb, Jsi_ValueArrayIndex(interp, args, 0), ret, 0);
if (jdb->maxStmts<0 || jdb->maxStmts>MAX_PREPARED_STMTS) {
JSI_DBQUERY_PRINTF( "option maxStmts value %d is not in range 0..%d", jdb->maxStmts, MAX_PREPARED_STMTS);
jdb->maxStmts = oms;
rc = JSI_ERROR;
}
if (oldu != jdb->user || oldpw != jdb->password || olddb != jdb->database)
if (!mysql_change_user(jdb->db, jdb->user, jdb->password, jdb->database)) {
rc = JSI_ERROR;
jdb->user = oldu;
jdb->password = oldpw;
jdb->database = olddb;
}
mdbStmtLimit(jdb);
return rc;
} | 22,958,826,726,819,260,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,757 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_TreeEntry *TreeStringCreate( Jsi_Tree *treePtr, const void *key, bool *newPtr)
{
Jsi_TreeEntry *hPtr;
size_t size;
if ((hPtr = Jsi_TreeEntryFind(treePtr, key))) {
if (newPtr)
*newPtr = 0;
return hPtr;
}
if (newPtr)
*newPtr = 1;
size = sizeof(Jsi_TreeEntry) + Jsi_Strlen((char*)key) /*- sizeof(jsi_TreeKey)*/ + 1;
hPtr = (Jsi_TreeEntry*)Jsi_Calloc(1,size);
SIGINIT(hPtr,TREEENTRY);
hPtr->typ = JSI_MAP_TREE;
hPtr->treePtr = treePtr;
hPtr->value = 0;
Jsi_Strcpy(hPtr->key.string, (char*)key);
treePtr->numEntries++;
return hPtr;
} | 64,893,777,840,634,480,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,758 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC DebugAddCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
if (!interp->breakpointHash)
interp->breakpointHash = Jsi_HashNew(interp, JSI_KEYS_STRING, jsi_HashFree);
int argc = Jsi_ValueGetLength(interp, args);
jsi_BreakPoint *bptr, bp = {};
Jsi_Number vnum;
if (argc>1 && Jsi_ValueGetBoolean(interp, Jsi_ValueArrayIndex(interp, args, 1), &bp.temp) != JSI_OK)
return Jsi_LogError("bad boolean");
Jsi_Value *v = Jsi_ValueArrayIndex(interp, args, 0);
if (Jsi_ValueGetNumber(interp, v, &vnum) == JSI_OK) {
bp.line = (int)vnum;
bp.file = interp->curFile;
} else {
const char *val = Jsi_ValueArrayIndexToStr(interp, args, 0, NULL);
const char *cp;
if (isdigit(val[0])) {
if (Jsi_GetInt(interp, val, &bp.line, 0) != JSI_OK)
return Jsi_LogError("bad number");
bp.file = interp->curFile;
} else if ((cp = Jsi_Strchr(val, ':'))) {
if (Jsi_GetInt(interp, cp+1, &bp.line, 0) != JSI_OK)
return Jsi_LogError("bad number");
Jsi_DString dStr = {};
Jsi_DSAppendLen(&dStr, val, cp-val);
bp.file = Jsi_KeyAdd(interp, Jsi_DSValue(&dStr));
Jsi_DSFree(&dStr);
} else {
bp.func = Jsi_KeyAdd(interp, val);
}
}
if (bp.line<=0 && !bp.func)
return Jsi_LogError("bad number");
char nbuf[JSI_MAX_NUMBER_STRING];
bp.id = ++interp->debugOpts.breakIdx;
bp.enabled = 1;
snprintf(nbuf, sizeof(nbuf), "%d", bp.id);
bptr = (jsi_BreakPoint*)Jsi_Malloc(sizeof(*bptr));
*bptr = bp;
Jsi_HashSet(interp->breakpointHash, (void*)nbuf, bptr);
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)bp.id);
return JSI_OK;
} | 31,230,646,420,108,893,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,759 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_subscript(jsi_Pstate *p, jsi_Pline *line, int right_val) { JSI_NEW_CODESLN(0,OP_SUBSCRIPT, right_val); } | 300,984,524,290,245,340,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,760 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Value *Jsi_StringSplit(Jsi_Interp *interp, const char *str, const char *spliton)
{
char **argv; int argc;
Jsi_DString dStr;
Jsi_DSInit(&dStr);
Jsi_SplitStr(str, &argc, &argv, spliton, &dStr);
Jsi_Value *nret = Jsi_ValueNewArray(interp, NULL, 0);
Jsi_Obj *obj = nret->d.obj;
int i;
for (i = 0; i < argc; ++i) {
Jsi_ObjArraySet(interp, obj, Jsi_ValueNewStringDup(interp, argv[i]), i);
}
Jsi_ObjSetLength(interp, obj, argc);
Jsi_ValueMakeArrayObject(interp, &nret, obj);
Jsi_DSFree(&dStr);
return nret;
} | 332,471,574,956,801,860,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,761 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void jsi_wswebsocketObjErase(jsi_wsCmdObj *cmdPtr)
{
if (cmdPtr->interp) {
if (cmdPtr->event)
Jsi_EventFree(cmdPtr->interp, cmdPtr->event);
cmdPtr->event = NULL;
if (cmdPtr->hasOpts)
Jsi_OptionsFree(cmdPtr->interp, WSOptions, cmdPtr, 0);
cmdPtr->hasOpts = 0;
if (cmdPtr->handlers)
Jsi_HashDelete(cmdPtr->handlers);
cmdPtr->handlers = NULL;
if (cmdPtr->pssTable)
Jsi_HashDelete(cmdPtr->pssTable);
cmdPtr->pssTable = NULL;
if (cmdPtr->fileHash)
Jsi_HashDelete(cmdPtr->fileHash);
cmdPtr->fileHash = NULL;
}
cmdPtr->interp = NULL;
} | 120,250,945,120,166,850,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,762 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_Wide jsi_strtoull(const char *str, char **endptr)
{
#ifdef JSI__LONG_LONG
int sign;
int base;
int i = JsiNumberBase(str, &base, &sign);
if (base != 10) {
Jsi_Wide value = strtoull(str + i, endptr, base);
if (endptr == NULL || *endptr != str + i) {
return value * sign;
}
}
/* Can just do a regular base-10 conversion */
return strtoull(str, endptr, 10);
#else
return (unsigned long)jsi_strtol(str, endptr);
#endif
} | 79,005,857,804,224,270,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,763 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void jsiDumpInstr(Jsi_Interp *interp, jsi_Pstate *ps, Jsi_Value *_this,
jsi_TryList *trylist, jsi_OpCode *ip, Jsi_OpCodes *opcodes)
{
int i;
char buf[JSI_MAX_NUMBER_STRING*2];
jsi_code_decode(interp, ip, ip - opcodes->codes, buf, sizeof(buf));
Jsi_Printf(interp, jsi_Stderr, "%p: %-30.200s : THIS=%s, STACK=[", ip, buf, jsi_evalprint(_this));
for (i = 0; i < interp->framePtr->Sp; ++i) {
Jsi_Printf(interp, jsi_Stderr, "%s%s", (i>0?", ":""), jsi_evalprint(_jsi_STACKIDX(i)));
}
Jsi_Printf(interp, jsi_Stderr, "]");
if (ip->fname) {
const char *fn = ip->fname, *cp = Jsi_Strrchr(fn, '/');
if (cp) fn = cp+1;
Jsi_Printf(interp, jsi_Stderr, ", %s:%d", fn, ip->Line);
}
Jsi_Printf(interp, jsi_Stderr, "\n");
jsi_TryList *tlt = trylist;
for (i = 0; tlt; tlt = tlt->next) i++;
if (ps->last_exception)
Jsi_Printf(interp, jsi_Stderr, "TL: %d, excpt: %s\n", i, jsi_evalprint(ps->last_exception));
} | 259,585,512,982,481,130,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,764 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_Number mdbMyTimeToJS(MYSQL_TIME* mtm)
{
struct tm tm;
tm.tm_sec = mtm->second;
tm.tm_min = mtm->minute;
tm.tm_hour = mtm->hour;
tm.tm_mday = mtm->day;
tm.tm_mon = mtm->month-1;
tm.tm_year = mtm->year - 1900;
time_t tim = mktime(&tm);
if (tim == (time_t)-1)
return -1;
return (Jsi_Number)tim*1000 + (Jsi_Number)mtm->second_part/1000000.0;
} | 322,602,524,068,393,730,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,765 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | char *jsiLNhints(const char *buf, int *color, int *bold) {
int i, len = Jsi_Strlen(buf);
for (i=0; jsiFilePreCmds[i]; i++)
if (!Jsi_Strncmp(buf, jsiFilePreCmds[i], Jsi_Strlen(jsiFilePreCmds[i]))) break;
if (jsiFilePreCmds[i]) {
const char *ce = buf+len-1, *cp = "('<file>";
if ((*ce =='\'' || *ce =='\"') && buf[len-2]=='(') cp+=2;
else if (*ce=='(') cp++;
else return NULL;
*color = 35;
*bold = 0;
return (char*)cp;
}
return NULL;
} | 248,606,516,969,650,400,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,766 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void jsiClearStack(Jsi_Interp *interp, int ofs) {
Jsi_Value **vPtr = &_jsi_STACKIDX(interp->framePtr->Sp-ofs), *v = *vPtr;
if (!v) return;
#ifndef XX_NEWSTACK
Jsi_ValueReset(interp, vPtr);
#else
if (v->refCnt<=1)
Jsi_ValueReset(interp, vPtr);
else {
Jsi_DecrRefCount(interp, v);
_jsi_STACKIDX(interp->framePtr->Sp-ofs) = Jsi_ValueNew1(interp);
}
#endif
} | 326,758,016,680,103,900,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,767 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_inc(jsi_Pstate *p, jsi_Pline *line, int e) { JSI_NEW_CODESLN(0,OP_INC, e); } | 332,188,679,836,507,850,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,768 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC MySqlQueryCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_RC rc = JSI_OK;
MySqlObj *jdb;
if (!(jdb = _mysql_getDbHandle(interp, _this, funcPtr))) return JSI_ERROR;
Jsi_Value *vSql = Jsi_ValueArrayIndex(interp, args, 0);
Jsi_DString eStr = {};
JSI_DSTRING_VAR(dStr, JSI_DB_DSTRING_SIZE);
const char *zSql = Jsi_ValueGetDString(interp, vSql, &eStr, 0);
Jsi_Value *arg = Jsi_ValueArrayIndex(interp, args, 1);
int cnt = 0;
char **apColName = NULL;
Jsi_OptionId *apColType = NULL;
int isopts = 0;
MyDbEvalContext sEval = {};
QueryOpts opts, *oEopt = NULL;
opts = jdb->queryOpts;
opts.callback = NULL;
opts.width = NULL;
Jsi_Value *callback = NULL, *width = NULL;
if (arg) {
if (Jsi_ValueIsFunction(interp,arg))
callback = opts.callback = arg;
else if (Jsi_ValueIsString(interp, arg))
opts.objName = Jsi_ValueString(interp, arg, NULL);
else if (Jsi_ValueIsObjType(interp, arg, JSI_OT_ARRAY))
opts.values = arg;
else if (Jsi_ValueIsObjType(interp, arg, JSI_OT_OBJECT))
isopts = 1;
else {
rc = Jsi_LogError("argument must be null, a function, string, array or options");
goto bail;
}
}
if (isopts) {
if (Jsi_OptionsProcess(interp, QueryFmtOptions, &opts, arg, 0) < 0) {
rc = JSI_ERROR;
goto bail;
}
callback = (opts.callback ? opts.callback : jdb->queryOpts.callback);
width = (opts.width ? opts.width : jdb->queryOpts.width);
}
/* if (jdb->queryOpts.CData) {
char *cdata = (char*)jdb->queryOpts.CData;
MySqlObjMultipleBind* copts = Jsi_CarrayLookup(interp, cdata);
if (!copts)
return Jsi_LogError("unknown CData option: %s", jdb->queryOpts.CData);
int n = MySqlObjQuery(jdb, copts->opts, copts->data, copts->numData, zSql, copts->flags);
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)n);
return JSI_OK;
} */
if (opts.objName) {
if (Jsi_SqlObjBinds(interp, &eStr, opts.objName, !(opts.objOpts&OBJMODE_NOTYPES),
!(opts.objOpts&OBJMODE_NODEFAULTS), (opts.objOpts&OBJMODE_NULLDEFAULTS)!=0) != JSI_OK)
goto bail;
zSql = Jsi_DSValue(&eStr);
}
if (!opts.separator) {
switch (opts.mode) {
case _mdb_EF_LIST: opts.separator = "|"; break;
case _mdb_EF_COLUMN: opts.separator = " "; break;
case _mdb_EF_TABS: opts.separator = "\t"; break;
default: opts.separator = ",";
}
}
Jsi_DString sStr;
Jsi_DSInit(&sStr);
sEval.nocache = opts.nocache;
if (mdbEvalInit(interp, &sEval, jdb, zSql, &sStr, 0, 0) != JSI_OK) {
rc = JSI_ERROR;
goto bail;
}
sEval.namedParams = (opts.noNamedParams==0 && !opts.values);
sEval.ret = *ret;
oEopt = jdb->optPtr;
jdb->optPtr = &opts;
if (sEval.namedParams) {
rc = mdbEvalPrep(&sEval);
if (rc == JSI_ERROR)
goto bail;
if (rc == JSI_BREAK) {
rc = JSI_OK;
goto bail;
}
}
if (opts.mode == _mdb_EF_NONE)
goto bail;
if (callback) {
sEval.tocall = callback;
if (opts.mode != _mdb_EF_ROWS)
rc = Jsi_LogError("'mode' must be 'rows' with 'callback'");
else
rc = mdbEvalCallCmd(&sEval, interp, JSI_OK);
goto bail;
}
switch (opts.mode) {
case _mdb_EF_NONE:
while(JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
goto bail;
break;
case _mdb_EF_JSON:
if (opts.headers) {
Jsi_DSAppend(dStr, "[ ", NULL);
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0) {
Jsi_DSAppend(dStr, "[", NULL);
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, ", ", NULL);
Jsi_JSONQuote(interp, apColName[i], -1, dStr);
}
Jsi_DSAppend(dStr, "]", NULL);
cnt++;
}
if (cnt)
Jsi_DSAppend(dStr, ", ", NULL);
Jsi_DSAppend(dStr, "[", NULL);
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, ", ", NULL);
mdbEvalSetColumnJSON(&sEval, i, dStr);
}
Jsi_DSAppend(dStr, "]", NULL);
cnt++;
if (opts.limit && cnt>opts.limit) break;
}
Jsi_DSAppend(dStr, " ]", NULL);
} else {
Jsi_DSAppend(dStr, "[ ", NULL);
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt)
Jsi_DSAppend(dStr, ", ", NULL);
Jsi_DSAppend(dStr, "{", NULL);
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, ", ", NULL);
Jsi_JSONQuote(interp, apColName[i], -1, dStr);
Jsi_DSAppend(dStr, ":", NULL);
mdbEvalSetColumnJSON(&sEval, i, dStr);
}
Jsi_DSAppend(dStr, "}", NULL);
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
Jsi_DSAppend(dStr, " ]", NULL);
}
break;
case _mdb_EF_JSON2: {
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0 && 1) {
Jsi_DSAppend(dStr, "{ \"names\": [ ", NULL);
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, ", ", NULL);
Jsi_JSONQuote(interp, apColName[i], -1, dStr);
}
Jsi_DSAppend(dStr, " ], \"values\": [ ", NULL);
}
if (cnt)
Jsi_DSAppend(dStr, ", ", NULL);
Jsi_DSAppend(dStr, "[", NULL);
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, ", ", NULL);
mdbEvalSetColumnJSON(&sEval, i, dStr);
}
Jsi_DSAppend(dStr, " ]", NULL);
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
if (cnt)
Jsi_DSAppend(dStr, " ] } ", NULL);
}
break;
case _mdb_EF_LIST:
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0 && opts.headers) {
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, opts.separator, NULL);
Jsi_DSAppend(dStr, apColName[i], NULL);
}
}
if (cnt || opts.headers)
Jsi_DSAppend(dStr, "\n", NULL);
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, opts.separator, NULL);
mdbEvalSetColumn(&sEval, i, dStr);
}
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
break;
case _mdb_EF_COLUMN: {
int *wids = NULL;
Jsi_DString vStr = {};
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i, w;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0 && nCol>0) {
Jsi_DString sStr;
wids = (int*)Jsi_Calloc(nCol, sizeof(int));
Jsi_DSInit(&sStr);
for(i=0; i<nCol; i++) {
int j = Jsi_Strlen(apColName[i]);
wids[i] = (j<10?10:j);
if (width) {
Jsi_Value *wv = Jsi_ValueArrayIndex(interp, width, i);
if (wv) {
Jsi_Number dv;
Jsi_ValueGetNumber(interp, wv, &dv);
if (dv>0)
wids[i] = (int)dv;
}
}
w = (j<wids[i] ? j : wids[i]);
Jsi_DSAppendLen(dStr, apColName[i], w);
w = (j<wids[i] ? wids[i]-j+1 : 0);
while (w-- > 0)
Jsi_DSAppend(dStr, " ", NULL);
}
for(i=0; i<nCol && opts.headers; i++) {
w = wids[i];
w -= Jsi_Strlen(apColName[i]);
if (i) {
Jsi_DSAppend(dStr, opts.separator, NULL);
Jsi_DSAppend(&sStr, opts.separator, NULL);
}
w = wids[i];
while (w-- > 0)
Jsi_DSAppend(&sStr, "-", NULL);
}
if (opts.headers)
Jsi_DSAppend(dStr, "\n", Jsi_DSValue(&sStr), "\n", NULL);
Jsi_DSFree(&sStr);
}
if (cnt)
Jsi_DSAppend(dStr, "\n", NULL);
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, opts.separator, NULL);
Jsi_DSSetLength(&vStr, 0);
mdbEvalSetColumn(&sEval, i, &vStr);
int nl = Jsi_DSLength(&vStr);
if (nl > wids[i]) {
Jsi_DSSetLength(&vStr, wids[i]);
w = 0;
} else {
w = wids[i]-nl;
}
Jsi_DSAppend(dStr, Jsi_DSValue(&vStr), NULL);
while (w-- > 0)
Jsi_DSAppend(dStr, " ", NULL);
}
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
Jsi_DSFree(&vStr);
if (wids)
Jsi_Free(wids);
break;
}
case _mdb_EF_INSERT: {
Jsi_DString vStr = {};
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
const char *tbl = (opts.table ? opts.table : "table");
if (cnt)
Jsi_DSAppend(dStr, "\n", NULL);
Jsi_DSAppend(dStr, "INSERT INTO ", tbl, " VALUES(", NULL);
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
for(i=0; i<nCol; i++) {
Jsi_Number dv;
const char *azArg;
Jsi_DSSetLength(&vStr, 0);
mdbEvalSetColumn(&sEval, i, &vStr);
MysqlPrep *prep = sEval.prep;
Jsi_OptionId ptype = prep->fieldResult[i].jsiTypeMap;
azArg = Jsi_DSValue(&vStr);
const char *zSep = i>0 ? ",": "";
if (azArg[i]==0 && ptype != JSI_OPTION_STRING) {
Jsi_DSAppend(dStr, zSep, "NULL", NULL);
} else if( ptype ==JSI_OPTION_STRING) {
if( zSep[0] ) Jsi_DSAppend(dStr,zSep, NULL);
mdbOutputQuotedString(dStr, azArg);
} else if (ptype==JSI_OPTION_BOOL || ptype ==JSI_OPTION_DOUBLE) {
Jsi_DSAppend(dStr, zSep, azArg, NULL);
} else if( Jsi_GetDouble(interp, azArg, &dv) == JSI_OK ) {
Jsi_DSAppend(dStr, zSep, azArg, NULL);
} else {
if( zSep[0] ) Jsi_DSAppend(dStr,zSep, NULL);
mdbOutputQuotedString(dStr, azArg);
}
}
Jsi_DSAppend(dStr, ");", NULL);
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
Jsi_DSFree(&vStr);
}
case _mdb_EF_TABS:
case _mdb_EF_CSV: {
Jsi_DString vStr = {};
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0 && opts.headers) {
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, opts.separator, NULL);
Jsi_DSAppend(dStr, apColName[i], NULL);
}
}
if (cnt || opts.headers)
Jsi_DSAppend(dStr, "\n", NULL);
for(i=0; i<nCol; i++) {
if (i)
Jsi_DSAppend(dStr, opts.separator, NULL);
Jsi_DSSetLength(&vStr, 0);
mdbEvalSetColumn(&sEval, i, &vStr);
if (opts.mode == _mdb_EF_CSV)
mdbOutputCsv(&opts, Jsi_DSValue(&vStr), dStr, 0);
else
Jsi_DSAppend(dStr, Jsi_DSValue(&vStr), NULL);
}
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
Jsi_DSFree(&vStr);
break;
}
case _mdb_EF_LINE: {
int i, w = 5, ww;
int nCol;
Jsi_DString vStr = {};
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0) {
for(i=0; i<nCol; i++) {
ww = Jsi_Strlen(apColName[i]);
if (ww>w)
w = ww;
}
}
for(i=0; i<nCol; i++) {
Jsi_DString eStr;
Jsi_DSInit(&eStr);
Jsi_DSSetLength(&vStr, 0);
mdbEvalSetColumn(&sEval, i, &vStr);
Jsi_DSPrintf(&eStr, "%*s = %s", w, apColName[i], Jsi_DSValue(&vStr));
Jsi_DSAppend(dStr, (cnt?"\n":""), Jsi_DSValue(&eStr), NULL);
Jsi_DSFree(&eStr);
}
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
Jsi_DSFree(&vStr);
break;
}
case _mdb_EF_HTML: {
Jsi_DString vStr = {};
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0 && opts.headers) {
Jsi_DSAppend(dStr, "<TR>", NULL);
for(i=0; i<nCol; i++) {
Jsi_DSAppend(dStr, "<TH>", NULL);
mdbOutputHtmlString(&opts, apColName[i], dStr);
Jsi_DSAppend(dStr, "</TH>", NULL);
}
Jsi_DSAppend(dStr, "</TR>", NULL);
}
if (cnt || opts.headers)
Jsi_DSAppend(dStr, "\n", NULL);
Jsi_DSAppend(dStr, "<TR>", NULL);
for(i=0; i<nCol; i++) {
Jsi_DSAppend(dStr, "<TD>", NULL);
Jsi_DSSetLength(&vStr, 0);
mdbEvalSetColumn(&sEval, i, &vStr);
mdbOutputHtmlString(&opts, Jsi_DSValue(&vStr), dStr);
Jsi_DSAppend(dStr, "</TD>", NULL);
}
Jsi_DSAppend(dStr, "</TR>", NULL);
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
Jsi_DSFree(&vStr);
break;
}
case _mdb_EF_ROWS:
{
Jsi_Value *vcur, *vrow;
int cnt = 0;
Jsi_Obj *oall, *ocur;
Jsi_ValueMakeArrayObject(interp, ret, oall = Jsi_ObjNewType(interp, JSI_OT_ARRAY));
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
ocur = Jsi_ObjNewType(interp, JSI_OT_OBJECT);
vrow = Jsi_ValueMakeObject(interp, NULL, ocur);
for(i=0; i<nCol; i++) {
vcur = mdbEvalSetColumnValue(&sEval, i, NULL);
Jsi_ObjInsert(interp, ocur, apColName[i], vcur, 0);
}
Jsi_ObjArrayAdd(interp, oall, vrow);
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
mdbEvalFinalize(&sEval);
if (rc != JSI_ERROR)
rc = JSI_OK;
goto bail;
break;
}
case _mdb_EF_ARRAYS:
{
Jsi_Value *vcur, *vrow;
int cnt = 0;
Jsi_Obj *oall, *ocur;
Jsi_ValueMakeArrayObject(interp, ret, oall = Jsi_ObjNewType(interp, JSI_OT_ARRAY));
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0 && opts.headers) {
vrow = Jsi_ValueMakeArrayObject(interp, NULL, ocur = Jsi_ObjNewType(interp, JSI_OT_ARRAY));
for(i=0; i<nCol; i++) {
vcur = Jsi_ValueNewStringDup(interp, apColName[i]);
Jsi_ObjArrayAdd(interp, ocur, vcur);
}
Jsi_ObjArrayAdd(interp, oall, vrow);
}
vrow = Jsi_ValueMakeArrayObject(interp, NULL, ocur = Jsi_ObjNewType(interp, JSI_OT_ARRAY));
for(i=0; i<nCol; i++) {
vcur = mdbEvalSetColumnValue(&sEval, i, NULL);
Jsi_ObjArrayAdd(interp, ocur, vcur);
}
Jsi_ObjArrayAdd(interp, oall, vrow);
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
mdbEvalFinalize(&sEval);
if (rc != JSI_ERROR)
rc = JSI_OK;
goto bail;
break;
}
case _mdb_EF_ARRAY1D:
{
Jsi_Value *vcur;
int cnt = 0;
Jsi_Obj *oall;
Jsi_ValueMakeArrayObject(interp, ret, oall = Jsi_ObjNewType(interp, JSI_OT_ARRAY));
while( JSI_OK==(rc = mdbEvalStep(&sEval)) ) {
int i;
int nCol;
mdbEvalRowInfo(&sEval, &nCol, &apColName, &apColType);
if (cnt == 0 && opts.headers) {
for(i=0; i<nCol; i++) {
vcur = Jsi_ValueNewStringDup(interp, apColName[i]);
Jsi_ObjArrayAdd(interp, oall, vcur);
}
}
for(i=0; i<nCol; i++) {
vcur = mdbEvalSetColumnValue(&sEval, i, NULL);
Jsi_ObjArrayAdd(interp, oall, vcur);
}
cnt++;
if (opts.limit && cnt>=opts.limit) break;
}
mdbEvalFinalize(&sEval);
if (rc != JSI_ERROR)
rc = JSI_OK;
goto bail;
break;
}
}
if( rc==JSI_BREAK ) {
rc = JSI_OK;
}
Jsi_ValueMakeStringDup(interp, ret, Jsi_DSValue(dStr));
bail:
mdbEvalFinalize(&sEval);
if (isopts) {
Jsi_OptionsFree(interp, QueryFmtOptions, &opts, 0);
}
Jsi_DSFree(dStr);
Jsi_DSFree(&eStr);
jdb->optPtr = oEopt;
return rc;
} | 66,957,416,781,694,715,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,769 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | jsi_wsgetPss(jsi_wsCmdObj *cmdPtr, struct lws *wsi, void *user, int create, int ishttp)
{
Jsi_HashEntry *hPtr;
bool isNew = 0;
jsi_wsPss *pss = NULL;
if (user==NULL)
return NULL;
int sfd = lws_get_socket_fd(wsi);
if (sfd<0) {
return NULL;
}
int sid = ((sfd<<1)|ishttp);
if (create)
hPtr = Jsi_HashEntryNew(cmdPtr->pssTable, (void*)(intptr_t)sid, &isNew);
else
hPtr = Jsi_HashEntryFind(cmdPtr->pssTable, (void*)(intptr_t)sid);
if (hPtr && !isNew)
pss = (typeof(pss))Jsi_HashValueGet(hPtr);
if (!pss) {
if (!create)
return NULL;
pss = (typeof(pss))Jsi_Calloc(1, sizeof(*pss));
Jsi_HashValueSet(hPtr, pss);
pss->sig = JWS_SIG_PWS;
pss->hPtr = hPtr;
Jsi_HashValueSet(hPtr, pss);
pss->cmdPtr = cmdPtr;
pss->wsi = wsi;
pss->user = user; /* unused. */
pss->state = PWS_CONNECTED;
pss->stats.createTime = time(NULL);
pss->cnt = cmdPtr->idx++;
pss->wid = sid;
//pss->sfd = sfd;
pss->udata = Jsi_ValueNewObj(cmdPtr->interp, NULL);
Jsi_IncrRefCount(cmdPtr->interp, pss->udata);
if (cmdPtr->debug>2)
fprintf(stderr, "PSS CREATE: %p/%p/%p (http=%d) = %d\n", pss, user, wsi, ishttp, sid);
if (!ishttp) {
pss->isWebsock = 1;
cmdPtr->stats.connectCnt++;
cmdPtr->createCnt++;
cmdPtr->createLast = time(NULL);
}
}
if (pss) {
WSSIGASSERT(pss, PWS);
pss->stats.eventCnt++;
pss->stats.eventLast = time(NULL);
cmdPtr->stats.eventCnt++;
cmdPtr->stats.eventLast = time(NULL);
}
return pss;
} | 180,492,113,624,349,280,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,770 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC jsiEvalFunction(jsi_Pstate *ps, jsi_OpCode *ip, int discard) {
Jsi_Interp *interp = ps->interp;
int stackargc = (int)(uintptr_t)ip->data;
jsiVarDeref(interp, stackargc + 1);
int tocall_index = interp->framePtr->Sp - stackargc - 1;
Jsi_Value *_this = _jsi_THISIDX(tocall_index),
*tocall = _jsi_STACKIDX(tocall_index), **spargs = _jsi_STACK+(interp->framePtr->Sp - stackargc),
*spretPtr = Jsi_ValueNew1(interp), *spretPtrOld = spretPtr,
*args = Jsi_ValueNewArrayObj(interp, spargs, stackargc, 1);
Jsi_IncrRefCount(interp, args);
if (_this->vt != JSI_VT_OBJECT)
_this = Jsi_ValueDup(interp, interp->Top_object);
else {
_this = Jsi_ValueDup(interp, _this);
jsiClearThis(interp, tocall_index);
}
Jsi_RC rc = jsi_FunctionSubCall(interp, args, _this, &spretPtr, tocall, discard);
jsiPop(interp, stackargc);
jsiClearStack(interp,1);
if (rc == JSI_CONTINUE) {
Jsi_ValueMakeUndef(interp, &_jsi_TOP);
rc = JSI_OK;
}
if (spretPtr == spretPtrOld) {
Jsi_ValueMove(interp, _jsi_TOP, spretPtr);
Jsi_DecrRefCount(interp, spretPtr);
} else {
/* returning a (non-copied) value reference */
Jsi_DecrRefCount(interp, _jsi_TOP);
_jsi_TOP = spretPtr;
}
Jsi_DecrRefCount(interp, args);
return rc;
} | 224,522,751,846,703,100,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,771 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void insert_case3(Jsi_TreeEntry* n) {
Jsi_TreeEntry *g, *u = uncle(n);
if (node_color(u) == _JSI_TREE_RED) {
set_color(n->parent, _JSI_TREE_BLACK);
set_color(u, _JSI_TREE_BLACK);
g = grandparent(n);
set_color(g, _JSI_TREE_RED);
insert_case1(g);
} else {
insert_case4(n);
}
} | 158,419,513,994,935,930,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,772 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void jsi_PstatePush(jsi_Pstate *ps)
{
Jsi_Interp *interp = ps->interp;
if (interp->cur_scope >= (int)(JSI_MAX_SCOPE - 1)) {
Jsi_LogBug("Scope chain too short");
return;
}
interp->cur_scope++;
} | 257,228,088,849,582,240,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,773 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | const char *jsi_OptionTypeStr(Jsi_OptionId typ, bool cName)
{
const Jsi_OptionTypedef* ti = Jsi_OptionTypeInfo(typ);
if (ti)
return (cName?ti->cName:ti->idName);
return NULL;
} | 242,329,958,184,459,200,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,774 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_NumberIsFiniteCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr, int op)
{
Jsi_Number num;
Jsi_Value *v;
bool b = 0;
int skip = 0;
ChkStringN(_this, funcPtr, v);
if (Jsi_GetNumberFromValue(interp, v, &num) != JSI_OK)
return JSI_ERROR;
switch (op) {
case 1: b = Jsi_NumberIsFinite(num); break;
case 2: b = Jsi_NumberIsInteger(num); break;
case 3: b = Jsi_NumberIsNaN(num); break;
case 4: b = Jsi_NumberIsSafeInteger(num); break;
}
Jsi_ValueMakeBool(interp, ret, b);
skip++;
return JSI_OK;
} | 309,312,471,758,527,830,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,775 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | char *Jsi_Realpath(Jsi_Interp *interp, Jsi_Value *src, char *newname)
{
/* TODO: resolve pwd first. */
void *data;
const char *cp = NULL;
Jsi_Filesystem *fsPtr;
Jsi_DString dStr;
Jsi_DSInit(&dStr);
const char *npath = Jsi_ValueNormalPath(interp, src, &dStr);
if (!npath) return NULL;
Jsi_Value *tPtr = Jsi_ValueNew1(interp);
Jsi_ValueMakeStringDup(interp, &tPtr, npath);
fsPtr = Jsi_FilesystemForPath(interp, tPtr, &data);
if (fsPtr) {
if (fsPtr->realpathProc)
cp = fsPtr->realpathProc(interp, src, newname);
else if (!newname)
cp = Jsi_Strdup(npath);
else {
Jsi_Strncpy(newname, npath, PATH_MAX);
if (Jsi_Strlen(npath)>=PATH_MAX)
newname[PATH_MAX-1] = 0;
}
}
Jsi_DSFree(&dStr);
Jsi_DecrRefCount(interp, tPtr);
return (char*)cp;
} | 48,617,441,464,702,695,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,776 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC Jsi_RegExpMatch(Jsi_Interp *interp, Jsi_Value *pattern, const char *v, int *rc, Jsi_DString *dStr)
{
Jsi_Regex *re;
int regexec_flags = 0;
if (rc)
*rc = 0;
if (pattern == NULL || pattern->vt != JSI_VT_OBJECT || pattern->d.obj->ot != JSI_OT_REGEXP)
return Jsi_LogError("expected pattern");
re = pattern->d.obj->d.robj;
regex_t *reg = &re->reg;
regmatch_t pos = {};
if (dStr)
Jsi_DSInit(dStr);
int r = regexec(reg, v, 1, &pos, regexec_flags);
if (r >= REG_BADPAT) {
char buf[JSI_MAX_NUMBER_STRING];
regerror(r, reg, buf, sizeof(buf));
return Jsi_LogError("error while matching pattern: %s", buf);
}
if (r != REG_NOMATCH) {
if (rc) *rc = 1;
if (dStr && pos.rm_so >= 0 && pos.rm_eo >= 0 && pos.rm_eo >= pos.rm_so)
Jsi_DSAppendLen(dStr, v + pos.rm_so, pos.rm_eo - pos.rm_so);
}
return JSI_OK;
} | 249,901,435,834,663,900,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,777 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_less() { JSI_NEW_CODES(0,OP_LESS, 0); } | 140,740,915,582,323,220,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,778 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC jsi_InitRegexp(Jsi_Interp *interp, int release)
{
if (!release)
interp->RegExp_prototype = Jsi_CommandCreateSpecs(interp, "RegExp", regexpCmds, NULL, JSI_CMDSPEC_ISOBJ);
return JSI_OK;
} | 50,348,232,193,426,810,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,779 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OpCodes *code_pop(int n) { JSI_NEW_CODES(0,OP_POP, n); } | 225,281,622,407,669,460,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,780 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void Jsi_MutexUnlock(Jsi_Interp *interp, Jsi_Mutex *mtx) { } | 262,813,693,317,797,980,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,781 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC Jsi_FunctionInvoke(Jsi_Interp *interp, Jsi_Value *func, Jsi_Value *args, Jsi_Value **ret, Jsi_Value *_this)
{
// Arrange for error reporting to point to called function.
Jsi_Func *fstatic = func->d.obj->d.fobj->func;
jsi_OpCode *oldops = interp->curIp;
if (fstatic->opcodes)
interp->curIp = fstatic->opcodes->codes;
Jsi_RC rc = jsi_FunctionInvoke(interp, func, args, ret, _this);
interp->curIp = oldops;
if (Jsi_InterpGone(interp))
return JSI_ERROR;
return rc;
} | 3,602,426,353,850,530,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,782 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC Jsi_ValueToObject(Jsi_Interp *interp, Jsi_Value *v)
{
Jsi_RC rc = JSI_OK;
if (v->vt == JSI_VT_OBJECT) return rc;
Jsi_Obj *o = Jsi_ObjNew(interp);
switch(v->vt) {
case JSI_VT_UNDEF:
case JSI_VT_NULL:
if (interp->strict) {
Jsi_LogError("converting a undefined/null value to object");
rc = JSI_ERROR;
}
o->d.num = 0;
o->ot = JSI_OT_NUMBER;
o->__proto__ = interp->Number_prototype;
break;
case JSI_VT_BOOL: {
o->d.val = v->d.val;
o->ot = JSI_OT_BOOL;
o->__proto__ = interp->Boolean_prototype;
break;
}
case JSI_VT_NUMBER: {
o->d.num = v->d.num;
o->ot = JSI_OT_NUMBER;
o->__proto__ = interp->Number_prototype;
break;
}
case JSI_VT_STRING: {
o->d.s = v->d.s;
if (!v->f.bits.isstrkey)
o->d.s.str = (char*)Jsi_KeyAdd(interp, v->d.s.str);
o->isstrkey = 1;
o->ot = JSI_OT_STRING;
o->__proto__ = interp->String_prototype;
break;
}
default:
Jsi_LogBug("toobject, not suppose to reach here");
}
Jsi_ValueReset(interp,&v);
Jsi_ValueMakeObject(interp, &v, o);
return rc;
} | 110,419,684,423,590,720,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,783 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static int jsi_FSCloseProc(Jsi_Channel chan) { return fclose(_JSI_GETFP(chan,1));} | 115,548,340,681,011,120,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,784 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static jsi_CaseList *caselist_insert(jsi_Pstate *pstate, jsi_CaseList *a, jsi_CaseExprStat *es)
{
jsi_CaseList *b = (jsi_CaseList*)Jsi_Calloc(1,sizeof(*b));
a->sig = JSI_SIG_CASELIST;
b->es = es;
a->tail->next = b;
a->tail = b;
return a;
} | 222,714,610,477,467,020,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,785 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void dbProfileHandler(void *cd, const char *zSql, sqlite_uint64 tm) {
int rc;
Jsi_Db *jdb = (Jsi_Db*)cd;
Jsi_Interp *interp = jdb->interp;
Jsi_Value *vpargs, *items[3] = {}, *ret;
items[0] = Jsi_ValueNewObj(interp, jdb->fobj);
items[1] = Jsi_ValueMakeStringDup(interp, NULL, zSql);
items[2] = Jsi_ValueMakeNumber(interp, NULL, (Jsi_Number)tm);
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, items, 3, 0));
Jsi_IncrRefCount(interp, vpargs);
ret = Jsi_ValueNew1(interp);
rc = Jsi_FunctionInvoke(interp, jdb->onProfile, vpargs, &ret, NULL);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK)
jdb->errCnt++;
} | 309,260,519,303,053,970,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,786 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC dbEvalCallCmd( DbEvalContext *p, Jsi_Interp *interp, Jsi_RC result)
{
int cnt = 0;
Jsi_RC rc = result;
Jsi_Value *varg1;
Jsi_Obj *argso;
char **apColName = NULL;
int *apColType = NULL;
if (p->jdb->debug & TMODE_EVAL)
JSI_DBQUERY_PRINTF( "DEBUG: eval\n");
while( (rc==JSI_OK) && JSI_OK==(rc = dbEvalStep(p)) ) {
int i;
int nCol;
cnt++;
dbEvalRowInfo(p, &nCol, &apColName, &apColType);
if (nCol<=0)
continue;
if (Jsi_ValueIsNull(interp,p->tocall))
continue;
/* Single object containing sql result members. */
varg1 = Jsi_ValueMakeObject(interp, NULL, argso = Jsi_ObjNew(interp));
for(i=0; i<nCol; i++) {
Jsi_Value *nnv = dbEvalSetColumnValue(p, i, NULL);
Jsi_ObjInsert(interp, argso, apColName[i], nnv, 0);
}
Jsi_IncrRefCount(interp, varg1);
bool rb = Jsi_FunctionInvokeBool(interp, p->tocall, varg1);
Jsi_DecrRefCount(interp, varg1);
if (Jsi_InterpGone(interp))
return JSI_ERROR;
if (rb)
break;
}
//dbEvalFinalize(p);
if( rc==JSI_OK || rc==JSI_BREAK ) {
//Jsi_ResetResult(interp);
rc = JSI_OK;
}
return rc;
} | 135,460,420,866,883,650,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,787 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | const char* jsi_GetDirective(Jsi_Interp *interp, Jsi_OpCodes *ops, const char *str) {
if (!ops) return NULL;
if (!ops->code_len) return NULL;
if (ops->codes[0].op != OP_PUSHSTR || !ops->codes[0].data) return NULL;
if (Jsi_Strncmp((char*)ops->codes[0].data, str, Jsi_Strlen(str))) return NULL;
return (char*)ops->codes[0].data;
} | 336,302,726,845,565,260,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,788 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Value* Jsi_ValueMakeObject(Jsi_Interp *interp, Jsi_Value **vPtr, Jsi_Obj *o) {
Jsi_Value *v = (vPtr?*vPtr:NULL);
if (v && v->vt == JSI_VT_OBJECT && o == v->d.obj)
return v;
if (v)
Jsi_ValueReset(interp, vPtr);
else
v = Jsi_ValueNew(interp);
//Jsi_IncrRefCount(interp, v);
if (!o)
o = Jsi_ObjNewType(interp, JSI_OT_OBJECT);
v->vt = JSI_VT_OBJECT;
v->d.obj = o;
Jsi_ObjIncrRefCount(interp,v->d.obj);
return v;
} | 332,598,368,921,293,540,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,789 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_TreeEntry *StringPtrCreate( Jsi_Tree *treePtr, const void *key, bool *newPtr)
{
return OneWordCreate(treePtr, key, newPtr);
} | 9,459,946,701,332,842,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,790 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Number Jsi_ValueToNumberInt(Jsi_Interp *interp, Jsi_Value *v, int isInt)
{
char *endPtr = NULL, *sptr;
Jsi_Number a = 0;
switch(v->vt) {
case JSI_VT_BOOL:
a = (Jsi_Number)(v->d.val ? 1.0: 0);
break;
case JSI_VT_NULL:
a = 0;
break;
case JSI_VT_OBJECT: {
Jsi_Obj *obj = v->d.obj;
switch(obj->ot) {
case JSI_OT_BOOL:
a = (Jsi_Number)(obj->d.val ? 1.0: 0);
break;
case JSI_OT_NUMBER:
a = obj->d.num;
break;
case JSI_OT_STRING:
sptr = obj->d.s.str;
goto donum;
break;
default:
a = 0;
break;
}
break;
}
case JSI_VT_UNDEF:
a = Jsi_NumberNaN();
break;
case JSI_VT_NUMBER:
a = v->d.num;
break;
case JSI_VT_STRING:
sptr = v->d.s.str;
donum:
if (!isInt) {
a = strtod(sptr, &endPtr);
if (endPtr && *endPtr) {
a = interp->NaNValue->d.num;
}
} else {
a = (Jsi_Number)strtol(sptr, &endPtr, 0);
if (!isdigit(*sptr))
a = interp->NaNValue->d.num;
}
break;
default:
Jsi_LogBug("Convert a unknown type: 0x%x to number", v->vt);
break;
}
if (isInt && Jsi_NumberIsNormal(a))
a = (Jsi_Number)((int64_t)(a));
return a;
} | 233,637,151,956,930,740,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,791 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static SqlFunc *dbFindSqlFunc(Jsi_Db *jdb, const char *zName) {
SqlFunc *p, *pNew;
int i;
pNew = (SqlFunc*)Jsi_Calloc(1, sizeof(*pNew) + Jsi_Strlen(zName) + 1 );
pNew->sig = SQLITE_SIG_FUNC;
pNew->zName = (char*)&pNew[1];
for(i=0; zName[i]; i++) {
pNew->zName[i] = tolower(zName[i]);
}
pNew->zName[i] = 0;
for(p=jdb->pFunc; p; p=p->pNext) {
if( Jsi_Strcmp(p->zName, pNew->zName)==0 ) {
Jsi_Free((char*)pNew);
return p;
}
}
pNew->interp = jdb->interp;
pNew->pScript = 0;
Jsi_DSInit(&pNew->dScript);
pNew->pNext = jdb->pFunc;
jdb->pFunc = pNew;
return pNew;
} | 225,173,305,037,660,800,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,792 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Value* Jsi_ValueMakeArrayObject(Jsi_Interp *interp, Jsi_Value **vPtr, Jsi_Obj *o) {
Jsi_Value *v = (vPtr?*vPtr:NULL);
if (!o)
o = Jsi_ObjNewType(interp, JSI_OT_ARRAY);
if (!v)
v = Jsi_ValueNew(interp);
else {
if (v->vt == JSI_VT_OBJECT && o == v->d.obj) {
if (!o->isarrlist) {
if (o->tree)
Jsi_TreeDelete( o->tree);
o->tree = NULL;
o->__proto__ = interp->Array_prototype;
o->isarrlist = 1;
}
return v;
}
Jsi_ValueReset(interp, vPtr);
}
v->vt = JSI_VT_OBJECT;
v->d.obj = o;
o->ot = JSI_OT_OBJECT;
o->__proto__ = interp->Array_prototype;
o->isarrlist = 1;
Jsi_ObjArraySizer(interp, o, 0);
Jsi_ObjIncrRefCount(interp,v->d.obj);
return v;
} | 162,399,286,883,528,580,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,793 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static int jsi_FSStatProc(Jsi_Interp *interp, Jsi_Value* path, Jsi_StatBuf *buf) {
const char *pathPtr = Jsi_ValueToString(interp, path, NULL);
Jsi_DString dStr = {};
if (*pathPtr == '~')
pathPtr = jsi_TildePath(interp, pathPtr, &dStr);
int rc = stat(pathPtr, buf);
Jsi_DSFree(&dStr);
return rc;
} | 317,373,575,702,235,140,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,794 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC WebSocketConstructor(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
if (Jsi_InterpAccess(interp, NULL, JSI_INTACCESS_NETWORK ) != JSI_OK)
return Jsi_LogError("WebSocket disallowed by Interp.noNetwork option");
jsi_wsCmdObj *cmdPtr;
Jsi_Value *toacc = NULL;
Jsi_Value *arg = Jsi_ValueArrayIndex(interp, args, 0);
cmdPtr = (jsi_wsCmdObj*)Jsi_Calloc(1, sizeof(*cmdPtr));
cmdPtr->sig = JWS_SIG_OBJ;
cmdPtr->_ = &wsObjCmd;
cmdPtr->_->newCnt++;
cmdPtr->_->activeCnt++;
cmdPtr->port = 8080;
cmdPtr->formParams = jsi_wsparam_str;
cmdPtr->maxUpload = 100000;
cmdPtr->interp = interp;
cmdPtr->ietf_version = -1;
cmdPtr->bufferPwr2 = 0;
cmdPtr->ws_gid = -1;
cmdPtr->ws_uid = -1;
cmdPtr->startTime = time(NULL);
cmdPtr->hasOpts = 1;
cmdPtr->includeFile = "include.shtml";
cmdPtr->jsiFnPattern = "jsig*.js";
if ((arg != NULL && !Jsi_ValueIsNull(interp,arg))
&& Jsi_OptionsProcess(interp, WSOptions, cmdPtr, arg, 0) < 0) {
bail:
jsi_wswebsocketObjFree(interp, cmdPtr);
return JSI_ERROR;
}
if (!cmdPtr->udata) {
cmdPtr->udata = Jsi_ValueNewObj(interp, NULL);
Jsi_IncrRefCount(interp, cmdPtr->udata);
}
Jsi_PathNormalize(interp, &cmdPtr->rootdir);
if (cmdPtr->headers && (Jsi_ValueGetLength(interp, cmdPtr->headers)%2)) {
Jsi_LogError("Odd header length");
goto bail;
}
const char *up = cmdPtr->urlPrefix, *ur = cmdPtr->urlRedirect;
if (up && ur && Jsi_Strncmp(ur, up, Jsi_Strlen(up))) {
Jsi_LogError("urlRedirect does not start with urlPrefix");
goto bail;
}
const char* subprot = (cmdPtr->protocol&&cmdPtr->protocol[0]?cmdPtr->protocol:"ws");
if (cmdPtr->protocol && !cmdPtr->protocol[0])
Jsi_LogWarn("empty protocol string: forcing to 'ws'");
cmdPtr->protocols[JWS_PROTOCOL_HTTP].name="http-only";
cmdPtr->protocols[JWS_PROTOCOL_HTTP].callback=jsi_wscallback_http;
cmdPtr->protocols[JWS_PROTOCOL_HTTP].per_session_data_size=sizeof(jsi_wsUser);
cmdPtr->protocols[JWS_PROTOCOL_WEBSOCK].name=subprot;
cmdPtr->protocols[JWS_PROTOCOL_WEBSOCK].callback=jsi_wscallback_websock;
cmdPtr->protocols[JWS_PROTOCOL_WEBSOCK].per_session_data_size=sizeof(jsi_wsUser);
if (cmdPtr->bufferPwr2 == 0)
cmdPtr->bufferPwr2 = 16;
if (cmdPtr->bufferPwr2>0) {
if (cmdPtr->bufferPwr2>20) {
Jsi_LogError("bufferPwr2 not in 0-20: %d", cmdPtr->bufferPwr2);
goto bail;
}
cmdPtr->protocols[JWS_PROTOCOL_WEBSOCK].rx_buffer_size=(1<<cmdPtr->bufferPwr2);
}
cmdPtr->pssTable = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, jsi_wsfreePss);
if (cmdPtr->onModify)
cmdPtr->fileHash = Jsi_HashNew(interp, JSI_KEYS_STRING, jsi_wsfreeFile);
cmdPtr->info.port = (cmdPtr->client ? CONTEXT_PORT_NO_LISTEN : cmdPtr->port);
cmdPtr->info.user = cmdPtr;
cmdPtr->info.iface = cmdPtr->interface ? Jsi_ValueString(interp, cmdPtr->interface, NULL) : NULL;
if (cmdPtr->local && !cmdPtr->info.iface)
cmdPtr->info.iface = "lo";
#ifdef __WIN32
cmdPtr->info.iface = NULL;
#endif
cmdPtr->info.protocols = cmdPtr->protocols;
if (!cmdPtr->noCompress)
cmdPtr->info.extensions = jsi_lws_exts;
cmdPtr->info.ssl_cert_filepath = cmdPtr->ssl_cert_filepath;
cmdPtr->info.ssl_private_key_filepath = cmdPtr->ssl_private_key_filepath;
cmdPtr->info.gid = cmdPtr->ws_gid;
cmdPtr->info.uid = cmdPtr->ws_uid;
cmdPtr->opts = LWS_SERVER_OPTION_SKIP_SERVER_CANONICAL_NAME|LWS_SERVER_OPTION_VALIDATE_UTF8;
cmdPtr->info.options = cmdPtr->opts;
cmdPtr->info.max_http_header_pool = 16;
cmdPtr->info.timeout_secs = 5;
cmdPtr->info.ssl_cipher_list = "ECDHE-ECDSA-AES256-GCM-SHA384:"
"ECDHE-RSA-AES256-GCM-SHA384:"
"DHE-RSA-AES256-GCM-SHA384:"
"ECDHE-RSA-AES256-SHA384:"
"HIGH:!aNULL:!eNULL:!EXPORT:"
"!DES:!MD5:!PSK:!RC4:!HMAC_SHA1:"
"!SHA1:!DHE-RSA-AES128-GCM-SHA256:"
"!DHE-RSA-AES128-SHA256:"
"!AES128-GCM-SHA256:"
"!AES128-SHA256:"
"!DHE-RSA-AES256-SHA256:"
"!AES256-GCM-SHA384:"
"!AES256-SHA256";
lws_set_log_level(cmdPtr->debug>255?cmdPtr->debug/256:0, NULL);
// TODO: WS2.2 Still leaks a small amount if server port unavailable.
if (!cmdPtr->client)
cmdPtr->info.options |= LWS_SERVER_OPTION_EXPLICIT_VHOSTS;
cmdPtr->context = lws_create_context(&cmdPtr->info);
if (cmdPtr->context == NULL) {
fail:
Jsi_LogError("libwebsocket init failed on port %d (try another port?)", cmdPtr->info.port);
goto bail;
}
if (cmdPtr->info.options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS) {
cmdPtr->info.options &= ~LWS_SERVER_OPTION_EXPLICIT_VHOSTS;
if (!lws_create_vhost(cmdPtr->context, &cmdPtr->info))
goto fail;
}
if (cmdPtr->client) {
struct lws_client_connect_info lci = {};
lci.context = cmdPtr->context;
lci.address = cmdPtr->address ? Jsi_ValueString(cmdPtr->interp, cmdPtr->address, NULL) : "127.0.0.1";
lci.port = cmdPtr->port;
lci.ssl_connection = cmdPtr->use_ssl;
lci.path = Jsi_ValueString(cmdPtr->interp, cmdPtr->rootdir, NULL);
lci.host = cmdPtr->clientHost?cmdPtr->clientHost:lws_canonical_hostname( cmdPtr->context );
lci.origin = cmdPtr->clientOrigin?cmdPtr->clientOrigin:"origin";
lci.protocol = cmdPtr->protocols[JWS_PROTOCOL_WEBSOCK].name;
lci.ietf_version_or_minus_one = cmdPtr->ietf_version;
#if (LWS_LIBRARY_VERSION_MAJOR>1)
if (cmdPtr->post)
lci.method = "POST";
else if (!Jsi_Strcmp(subprot, "get"))
lci.method = "GET";
#endif
if (NULL == lws_client_connect_via_info(&lci))
{
Jsi_LogError("websock connect failed");
jsi_wswebsocketObjFree(interp, cmdPtr);
return JSI_ERROR;
}
} else if (cmdPtr->port == 0) {
// Extract actually used port.
char *cp, cbuf[JSI_BUFSIZ*2];
cbuf[0] = 0;
lws_json_dump_context(cmdPtr->context, cbuf, sizeof(cbuf), 0);
cp = Jsi_Strstr(cbuf, "\"port\":\"");
if (cp)
cmdPtr->port = atoi(cp+8);
}
cmdPtr->event = Jsi_EventNew(interp, jsi_wswebsockUpdate, cmdPtr);
if (Jsi_FunctionIsConstructor(funcPtr)) {
toacc = _this;
} else {
Jsi_Obj *o = Jsi_ObjNew(interp);
Jsi_PrototypeObjSet(interp, "WebSocket", o);
Jsi_ValueMakeObject(interp, ret, o);
toacc = *ret;
}
Jsi_Obj *fobj = Jsi_ValueGetObj(interp, toacc);
if ((cmdPtr->objId = Jsi_UserObjNew(interp, &websockobject, fobj, cmdPtr))<0) {
goto bail;
}
Jsi_UserObjName(interp, toacc, &cmdPtr->cName);
cmdPtr->handlers = Jsi_HashNew(interp, JSI_KEYS_STRING, jsi_wsfreeHandlers);
if (cmdPtr->extHandlers) {
jsi_wsHandlerAdd(interp, cmdPtr, ".jsi", "Jspp", 1);
jsi_wsHandlerAdd(interp, cmdPtr, ".htmli", "Htmlpp", 1);
jsi_wsHandlerAdd(interp, cmdPtr, ".cssi", "Csspp", 1);
}
cmdPtr->fobj = fobj;
#ifdef LWS_LIBRARY_VERSION_NUMBER
Jsi_JSONParseFmt(interp, &cmdPtr->version, "{libVer:\"%s\", hdrVer:\"%s\", hdrNum:%d, pkgVer:%d}",
(char *)lws_get_library_version(), LWS_LIBRARY_VERSION, LWS_LIBRARY_VERSION_NUMBER, jsi_WsPkgVersion);
#endif
return JSI_OK;
} | 227,622,229,110,330,600,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,795 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | bool dbIsAlnumStr(const char *cp)
{
if (!cp || !*cp) return 0;
while (*cp)
if (isalnum(*cp) || *cp == '_')
cp++;
else
return 0;
return 1;
} | 143,345,520,779,855,460,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,796 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_logic_less(Jsi_Interp* interp, int i1, int i2) {
Jsi_Value *v, *v1 = _jsi_STACK[interp->framePtr->Sp-i1], *v2 = _jsi_STACK[interp->framePtr->Sp-i2], *res = _jsi_TOQ;
int val = 0, l1 = 0, l2 = 0;
bool strict = interp->strict;
Jsi_RC rc = JSI_OK;
rc = _jsi_StrictUChk2(v1, v2);
if (rc != JSI_OK)
return JSI_ERROR;
char *s1 = Jsi_ValueString(interp, v1, &l1);
char *s2 = Jsi_ValueString(interp, v2, &l2);
Jsi_Number n1, n2;
if (s1 || s2) {
char *str;
if (!(s1 && s2)) {
v = (s1 ? v2 : v1);
jsi_ValueToPrimitive(interp, &v);
Jsi_ValueToString(interp, v, NULL);
str = Jsi_ValueString(interp, v, (s1?&l2:&l1));
if (s1) s2 = str; else s1 = str;
}
Assert(l1>=0 && l1<=JSI_MAX_ALLOC_BUF);
Assert(l2>=0 && l2<=JSI_MAX_ALLOC_BUF);
//int mlen = (l1>l2?l1:l2);
val = Jsi_Strcmp(s1, s2);
if (val > 0) val = 0;
else if (val < 0) val = 1;
else val = (l1 < l2);
jsiClearStack(interp,2);
Jsi_ValueMakeBool(interp, &res, val);
} else {
Jsi_ValueToNumber(interp, v1);
Jsi_ValueToNumber(interp, v2);
rc = _jsi_StrictChk2(v1,v2);
if (rc != JSI_OK)
return JSI_ERROR;
n1 = v1->d.num; n2 = v2->d.num;
if (Jsi_NumberIsNaN(n1) || Jsi_NumberIsNaN(n2)) {
jsiClearStack(interp,2);
Jsi_ValueMakeUndef(interp, &res);
} else {
val = (n1 < n2);
jsiClearStack(interp,2);
Jsi_ValueMakeBool(interp, &res, val);
}
}
return JSI_OK;
} | 285,393,937,689,005,170,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,797 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void mdbJsToMyTime(Jsi_Number time, MYSQL_TIME* mtm, int utc)
{
struct tm tm;
time_t tim = (time_t)(time/1000);
if (utc)
gmtime_r(&tim, &tm);
else
localtime_r(&tim, &tm);
mtm->second = tm.tm_sec;
mtm->minute = tm.tm_min;
mtm->hour = tm.tm_hour;
mtm->day = tm.tm_mday;
mtm->month = tm.tm_mon+1;
mtm->year = tm.tm_year + 1900;
Jsi_Number secs = (tim/1000.0);
mtm->second_part = (int)((secs-(int)secs)*1000000);
} | 281,730,233,088,661,760,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,798 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC FilesysPutsCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
UdfGet(udf, _this, funcPtr);
if (!udf->filename) {
Jsi_ValueMakeBool(interp, ret, 0);
return JSI_OK;
}
Jsi_Value *toput = Jsi_ValueArrayIndex(interp, args, 0);
if (!toput) {
Jsi_ValueMakeBool(interp, ret, 0);
return JSI_OK;
}
const char * cp = Jsi_ValueToString(interp, toput, NULL);
if (Jsi_Printf(interp, udf->chan, "%s\n", cp?cp:"") < 0) {
Jsi_ValueMakeBool(interp, ret, 0);
return JSI_OK;
}
Jsi_ValueMakeBool(interp, ret, 1);
return JSI_OK;
} | 128,637,029,267,605,980,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,799 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC WebSocketConfCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
jsi_wsCmdObj *cmdPtr = (jsi_wsCmdObj*)Jsi_UserObjGetData(interp, _this, funcPtr);
if (!cmdPtr)
return Jsi_LogError("Apply in a non-websock object");
Jsi_Value *opts = Jsi_ValueArrayIndex(interp, args, 0);
if (cmdPtr->noConfig && opts && !Jsi_ValueIsString(interp, opts))
return Jsi_LogError("WebSocket conf() is disabled for set");
return Jsi_OptionsConf(interp, WSOptions, cmdPtr, opts, ret, 0);
} | 169,250,569,292,502,900,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,800 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_OptionSpec * jsi_GetCachedOptionSpecs(Jsi_Interp *interp, const Jsi_OptionSpec *staticSpecs)
{
return (Jsi_OptionSpec *)staticSpecs;
} | 321,839,175,738,158,040,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,801 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC jsi_FunctionInvoke(Jsi_Interp *interp, Jsi_Value *tocall, Jsi_Value *args, Jsi_Value **ret, Jsi_Value *_this)
{
if (interp->maxDepth>0 && interp->maxDepth && interp->callDepth>=interp->maxDepth)
return Jsi_LogError("max call depth exceeded");
if (interp->deleting)
return JSI_ERROR;
if (!Jsi_ValueIsFunction(interp, tocall))
return Jsi_LogError("can not execute expression, expression is not a function");
if (!tocall->d.obj->d.fobj) { /* empty function */
return JSI_OK;
}
if (!ret) {
if (!interp->nullFuncRet) {
interp->nullFuncRet = Jsi_ValueNew(interp);
Jsi_IncrRefCount(interp, interp->nullFuncRet);
}
ret = &interp->nullFuncRet;
Jsi_ValueMakeUndef(interp, ret);
}
if (!args) {
if (!interp->nullFuncArg) {
interp->nullFuncArg = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, NULL, 0, 0));
Jsi_IncrRefCount(interp, interp->nullFuncArg);
}
args = interp->nullFuncArg;
}
/* func to call */
Jsi_Func *funcPtr = tocall->d.obj->d.fobj->func;
SIGASSERT(funcPtr, FUNC);
/* prepare args */
if (args->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, args->d.obj))
return Jsi_LogError("argument must be an array");
/* new this */
Jsi_Value *fthis = Jsi_ValueDup(interp, _this ? _this : tocall);
Jsi_Func *prevActive = interp->activeFunc;
Jsi_RC res = jsi_SharedArgs(interp, args, funcPtr, 1);
bool isalloc = 0;
int calltrc = 0;
int tc = interp->traceCall | (funcPtr->pkg?funcPtr->pkg->popts.modConf.traceCall:0);
interp->callDepth++;
if (res == JSI_OK) {
jsi_InitLocalVar(interp, args, funcPtr);
jsi_SetCallee(interp, args, tocall);
isalloc = 1;
Jsi_IncrRefCount(interp, args);
if (funcPtr->type == FC_NORMAL) {
if ((tc&jsi_callTraceFuncs) && funcPtr->name)
calltrc = 1;
} else {
if ((tc&jsi_callTraceCmds) && funcPtr->name)
calltrc = 1;
}
interp->activeFunc = funcPtr;
if (funcPtr->type == FC_NORMAL) {
if (calltrc)
jsi_TraceFuncCall(interp, funcPtr, NULL, fthis, args, NULL, tc);
res = jsi_evalcode(interp->ps, funcPtr, funcPtr->opcodes, tocall->d.obj->d.fobj->scope,
args, fthis, ret);
} else {
if (calltrc)
jsi_TraceFuncCall(interp, funcPtr, NULL, fthis, args, NULL, tc);
res = funcPtr->callback(interp, args, fthis, ret, funcPtr);
}
funcPtr->callCnt++;
}
interp->callDepth--;
if (res == JSI_OK && funcPtr->retType)
res = jsi_ArgTypeCheck(interp, funcPtr->retType, *ret, "returned from", funcPtr->name, 0, funcPtr, 0);
if (calltrc && (tc&jsi_callTraceReturn))
jsi_TraceFuncCall(interp, funcPtr, NULL, fthis, NULL, *ret, tc);
interp->activeFunc = prevActive;
jsi_SharedArgs(interp, args, funcPtr, 0);
if (isalloc)
Jsi_DecrRefCount(interp, args);
Jsi_DecrRefCount(interp, fthis);
return res;
} | 81,366,355,022,063,860,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,802 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void searchSpace(Jsi_TreeSearch *searchPtr, int n)
{
if ((searchPtr->top+n) >= searchPtr->max) {
int i, cnt = (searchPtr->max *= 2);
if (searchPtr->Ptrs == searchPtr->staticPtrs)
searchPtr->Ptrs = (Jsi_TreeEntry**)Jsi_Calloc(cnt, sizeof(Jsi_TreeEntry*));
else
searchPtr->Ptrs = (Jsi_TreeEntry**)Jsi_Realloc(searchPtr->Ptrs, cnt* sizeof(Jsi_TreeEntry*));
for (i=0; i<cnt; i++)
SIGINIT((searchPtr->Ptrs[i]),TREEENTRY);
}
} | 69,707,185,204,620,240,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,803 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | int Jsi_MapEntryDelete (Jsi_MapEntry *entryPtr){
switch (jsi_GetListType(entryPtr)) {
case JSI_MAP_HASH: return Jsi_HashEntryDelete((Jsi_HashEntry*)entryPtr);
case JSI_MAP_TREE: return Jsi_TreeEntryDelete((Jsi_TreeEntry*)entryPtr);
case JSI_MAP_LIST: {
Jsi_ListEntry *lptr = (Jsi_ListEntry*)entryPtr;
Jsi_ListPop(lptr->list, lptr);
Jsi_ListEntryDelete(lptr);
return 1;
}
}
return JSI_OK;
} | 47,363,130,137,530,200,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,804 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void jsiClearThis(Jsi_Interp *interp, int ofs) {
Jsi_Value **vPtr = &_jsi_THISIDX(ofs), *v = *vPtr;
if (!v) return;
#ifndef XX_NEWSTACK
Jsi_ValueReset(interp, vPtr);
#else
if (v->refCnt<=1)
Jsi_ValueReset(interp, vPtr);
else {
Jsi_DecrRefCount(interp, v);
_jsi_THISIDX(ofs) = Jsi_ValueNew1(interp);
}
#endif
} | 262,192,870,010,557,800,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,805 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_RC Jsi_ThisDataSet(Jsi_Interp *interp, Jsi_Value *_this, void *value)
{
bool isNew;
Jsi_HashEntry *hPtr = Jsi_HashEntryNew(interp->thisTbl, _this, &isNew);
if (!hPtr)
return JSI_ERROR;
Jsi_HashValueSet(hPtr, value);
return JSI_OK;
} | 55,899,002,451,446,970,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,806 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void* Jsi_CurrentThread(void) { return NULL; } | 104,046,340,739,093,430,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,807 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC ValueToCArray(Jsi_Interp *interp, Jsi_OptionSpec* spec, Jsi_Value *inValue, const char *inStr, void *record, Jsi_Wide flags)
{
if (inStr)
return JSI_ERROR;
uchar *s = (uchar*)((char*)record) + spec->offset;
Jsi_OptionSpec *subSpec = spec->init.OPT_CARRAY;
int argc, i, isize, size = spec->arrSize;
if (!subSpec || size<=0 || (isize=subSpec->size)<=0)
goto bail;
isize = isize/size;
if (!Jsi_ValueIsArray(interp, inValue))
return Jsi_LogError("expected array");
argc = Jsi_ValueGetLength(interp, inValue);
if (argc != size)
return Jsi_LogError("array length %d was not %d", argc, size);
for (i = 0; i<size; i++) {
Jsi_Value *v = Jsi_ValueArrayIndex(interp, inValue, i);
if (Jsi_OptionsSet(interp, subSpec, (void*)s, subSpec->name, v, 0) != JSI_OK)
return JSI_ERROR;
s += isize;
}
return JSI_OK;
bail:
return Jsi_LogError("bad config");
} | 74,583,197,945,068,470,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,808 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | void jsi_ScopeStrsFree(Jsi_Interp *interp, Jsi_ScopeStrs *ss)
{
if (!ss) return;
int i;
for (i=0; i<ss->count; i++)
if (ss->args[i].defValue)
Jsi_DecrRefCount(interp, ss->args[i].defValue);
if (ss->args)
Jsi_Free(ss->args);
Jsi_Free(ss);
} | 228,903,479,627,261,100,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,809 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static void MutexUnlock(Jsi_Mutex* mtx) { LeaveCriticalSection(&mtx->mtx); } | 17,940,836,961,448,820,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,810 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_OptionsFind(Jsi_Interp *interp, Jsi_OptionSpec *specs, const char *name, Jsi_Wide flags)
{
Jsi_OptionSpec *specPtr;
char c; /* First character of current argument. */
Jsi_OptionSpec *matchPtr; /* Matching spec, or NULL. */
size_t length;
const char *matStr = NULL;
if (name == NULL) {
Jsi_LogError("Null name for option");
return NULL;
}
c = name[0];
length = Jsi_Strlen(name);
matchPtr = NULL;
for (specPtr = specs; specPtr->id>=JSI_OPTION_BOOL && specPtr->id < JSI_OPTION_END && specPtr->name; specPtr++) {
if ((specPtr->name[0] != c)
|| (Jsi_Strncmp(specPtr->name, name, length) != 0)) {
continue;
}
if (specPtr->name[length] == 0) {
return specPtr; /* Stop on a perfect match. */
}
if (matchPtr != NULL) {
Jsi_LogError("ambiguous option \"%s\" matches both \"%s\" and \"%s\"", name, matStr, specPtr->name);
return (Jsi_OptionSpec *) NULL;
}
matchPtr = specPtr;
matStr = specPtr->name;
}
if (matchPtr == NULL) {
Jsi_DString dStr = {};
Jsi_DSAppend(&dStr, "unknown option \"", name, "\" not one of: ", NULL);
for (specPtr = specs; specPtr->id>=JSI_OPTION_BOOL && specPtr->id < JSI_OPTION_END && specPtr->name; specPtr++) {
if (specPtr->name == NULL) {
break;
}
if (name[0] != '?' || _JSICASTINT(specPtr->id) < 0 || specPtr->id >= JSI_OPTION_END) {
Jsi_DSAppend(&dStr, specPtr->name, " ", NULL);
} else {
Jsi_DSAppend(&dStr, "?", specPtr->name, " <", jsi_OptTypeInfo[specPtr->id].idName, ">? ", NULL);
}
}
assert(specPtr->id == JSI_OPTION_END);
Jsi_LogError("%s", Jsi_DSValue(&dStr));
Jsi_DSFree(&dStr);
return (Jsi_OptionSpec *) NULL;
}
return matchPtr;
} | 114,815,152,275,710,230,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,811 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_TreeEntry *searchAdd(Jsi_TreeSearch *searchPtr, Jsi_TreeEntry *hPtr)
{
int order = (searchPtr->flags & JSI_TREE_ORDER_MASK);
searchSpace(searchPtr, 2);
switch (order) {
case JSI_TREE_ORDER_LEVEL:
if (hPtr) {
if (hPtr->right)
searchPtr->Ptrs[searchPtr->top++] = hPtr->right;
if (hPtr->left)
searchPtr->Ptrs[searchPtr->top++] = hPtr->left;
return hPtr;
}
if (searchPtr->top<=0)
return NULL;
hPtr = searchPtr->Ptrs[0];
searchPtr->top--;
if (searchPtr->top > 0) {
/* Not very efficient way to implement a queue, but works for now. */
memmove(searchPtr->Ptrs, searchPtr->Ptrs+1, sizeof(Jsi_TreeEntry*)*searchPtr->top);
}
if (hPtr->right)
searchPtr->Ptrs[searchPtr->top++] = hPtr->right;
if (hPtr->left)
searchPtr->Ptrs[searchPtr->top++] = hPtr->left;
return hPtr;
break;
case JSI_TREE_ORDER_POST:
if (hPtr)
searchPtr->Ptrs[searchPtr->top++] = searchPtr->current = hPtr;
while (searchPtr->top>0) {
hPtr = searchPtr->Ptrs[searchPtr->top-1];
if (hPtr->right == searchPtr->current || hPtr->left == searchPtr->current ||
(hPtr->left == NULL && hPtr->right == NULL)) {
searchPtr->top--;
searchPtr->current = hPtr;
return hPtr;
} else {
searchSpace(searchPtr, 2);
if (hPtr->left)
searchPtr->Ptrs[searchPtr->top++] = hPtr->left;
if (hPtr->right)
searchPtr->Ptrs[searchPtr->top++] = hPtr->right;
}
}
return NULL;
break;
case JSI_TREE_ORDER_PRE:
if (!hPtr) {
if (searchPtr->top<=0) return NULL;
hPtr = searchPtr->Ptrs[--searchPtr->top];
}
searchPtr->Ptrs[searchPtr->top++] = hPtr;
if (hPtr->left) searchPtr->Ptrs[searchPtr->top++] = hPtr->left;
if (hPtr->right) searchPtr->Ptrs[searchPtr->top++] = hPtr->right;
break;
case JSI_TREE_ORDER_IN:
while (1) {
searchSpace(searchPtr, 2);
if (searchPtr->current) {
searchPtr->Ptrs[searchPtr->top++] = searchPtr->current;
searchPtr->current = searchPtr->current->right;
} else {
if (searchPtr->top<=0)
return NULL;
hPtr = searchPtr->Ptrs[--searchPtr->top] ;
searchPtr->current = hPtr->left;
return hPtr;
}
}
break;
default:
if (hPtr) {
Jsi_Interp *interp = hPtr->treePtr->opts.interp;
JSI_NOTUSED(interp);
Jsi_LogError("Invalid order: %d", order);
}
}
return searchPtr->Ptrs[--searchPtr->top];
} | 316,504,402,631,067,550,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,812 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | jsi_SetOption_(Jsi_Interp *interp, Jsi_OptionSpec *specPtr, const char *string /*UNUSED*/, void* rec, Jsi_Value *argValue, Jsi_Wide flags, bool isSafe)
{
Jsi_Wide wcount = 0;
bool bn;
Jsi_Number nv;
bool isIncr = (flags & JSI_OPTS_INCR);
const char *expType = NULL;
char *record = (char*)rec, *ptr = record + specPtr->offset;
Jsi_OptionCustom* cust = NULL;
const char *emsg = NULL, *epre = "";
if (specPtr->id<JSI_OPTION_BOOL || specPtr->id>=JSI_OPTION_END)
return Jsi_LogBug("unknown option id \"%d\" for \"%s\"", specPtr->id, specPtr->name);
if (specPtr->custom && specPtr->id == JSI_OPTION_CUSTOM) {
cust = Jsi_OptionCustomBuiltin(specPtr->custom);
if (cust && cust->parseProc) {
int lastErrCnt = interp->logErrorCnt;
Jsi_OptionSpec *oep = interp->parseMsgSpec;
interp->parseMsgSpec = specPtr;
Jsi_RC rc = (*cust->parseProc)(interp, specPtr, argValue, NULL, record, flags);
if (rc != JSI_OK) {
if (!interp->csc || lastErrCnt == interp->logErrorCnt)
Jsi_LogError("invalid value");
interp->parseMsgSpec = oep;
return JSI_ERROR;
}
interp->parseMsgSpec = oep;
} else
return Jsi_LogBug("missing or bad custom for \"%s\"", specPtr->name);
goto done;
}
switch (specPtr->id) {
case JSI_OPTION_CUSTOM:
if (!specPtr->custom)
return Jsi_LogBug("missing or custom for \"%s\"", specPtr->name);
case JSI_OPTION_BOOL: {
if (!argValue)
*(char*)ptr = 0;
else if (!Jsi_ValueIsBoolean(interp, argValue))
goto bail;
Jsi_GetBoolFromValue(interp, argValue, &bn);
*(char*)ptr = bn;
break;
}
case JSI_OPTION_INT:
case JSI_OPTION_UINT:
case JSI_OPTION_LONG:
case JSI_OPTION_INTPTR_T:
case JSI_OPTION_UINTPTR_T:
case JSI_OPTION_SIZE_T:
case JSI_OPTION_SSIZE_T:
case JSI_OPTION_ULONG:
case JSI_OPTION_SHORT:
case JSI_OPTION_USHORT:
case JSI_OPTION_UINT64:
case JSI_OPTION_INT64:
case JSI_OPTION_INT8:
case JSI_OPTION_UINT8:
case JSI_OPTION_INT16:
case JSI_OPTION_UINT16:
case JSI_OPTION_INT32:
case JSI_OPTION_UINT32:
wcount = 0;
if (argValue) {
if (!Jsi_ValueIsNumber(interp, argValue))
goto bail;
if (Jsi_GetWideFromValue(interp, argValue, &wcount) != JSI_OK) {
return JSI_ERROR;
}
}
switch (specPtr->id) {
#define _JSI_OPTSETTYP(typ, n, ptr) if (isIncr) n += *((typ *)ptr); \
if (isIncr || ((Jsi_Wide)(typ)(n)) == (n)) interp->cdataIncrVal = *((typ *)ptr) = (typ)(n); else expType = #typ;
case JSI_OPTION_INT: _JSI_OPTSETTYP(int, wcount, ptr); break;
case JSI_OPTION_UINT: _JSI_OPTSETTYP(uint, wcount, ptr); break;
case JSI_OPTION_INTPTR_T: _JSI_OPTSETTYP(intptr_t, wcount, ptr); break;
case JSI_OPTION_UINTPTR_T:_JSI_OPTSETTYP(uintptr_t, wcount, ptr); break;
case JSI_OPTION_SIZE_T: _JSI_OPTSETTYP(size_t, wcount, ptr); break;
case JSI_OPTION_SSIZE_T: _JSI_OPTSETTYP(ssize_t, wcount, ptr); break;
case JSI_OPTION_LONG: _JSI_OPTSETTYP(long, wcount, ptr); break;
case JSI_OPTION_ULONG: _JSI_OPTSETTYP(ulong, wcount, ptr); break;
case JSI_OPTION_SHORT: _JSI_OPTSETTYP(short, wcount, ptr); break;
case JSI_OPTION_USHORT: _JSI_OPTSETTYP(ushort, wcount, ptr); break;
case JSI_OPTION_INT8: _JSI_OPTSETTYP(int8_t, wcount, ptr); break;
case JSI_OPTION_UINT8: _JSI_OPTSETTYP(uint8_t, wcount, ptr) break;
case JSI_OPTION_INT16: _JSI_OPTSETTYP(int16_t, wcount, ptr); break;
case JSI_OPTION_UINT16: _JSI_OPTSETTYP(uint16_t, wcount, ptr); break;
case JSI_OPTION_INT32: _JSI_OPTSETTYP(int32_t, wcount, ptr); break;
case JSI_OPTION_UINT32: _JSI_OPTSETTYP(uint32_t, wcount, ptr); break;
case JSI_OPTION_INT64: _JSI_OPTSETTYP(int64_t, wcount, ptr); break;
case JSI_OPTION_UINT64: _JSI_OPTSETTYP(uint64_t, wcount, ptr); break; // TODO: might loose top sign bit...
default: break;
}
if (expType)
return Jsi_LogType("not a %s", expType);
isIncr = 0;
break;
case JSI_OPTION_NUMBER:
case JSI_OPTION_DOUBLE:
case JSI_OPTION_LDOUBLE:
case JSI_OPTION_FLOAT:
nv = 0;
if (argValue) {
if (!Jsi_ValueIsNumber(interp, argValue))
goto bail;
if (Jsi_GetNumberFromValue(interp, argValue, &nv) != JSI_OK) {
return JSI_ERROR;
}
}
switch (specPtr->id) {
#define _JSI_OPTSETNTYP(typ, n, ptr) if (!argValue) *(typ*)ptr = 0; else { if (isIncr) n += *((typ *)ptr); \
interp->cdataIncrVal = *((typ *)ptr) = (typ)(n); \
if (interp->strict && Jsi_NumberIsNaN((Jsi_Number)(*((typ *)ptr)))) return Jsi_LogError("not a number"); }
case JSI_OPTION_NUMBER: _JSI_OPTSETNTYP(Jsi_Number, nv, ptr); break;
case JSI_OPTION_LDOUBLE: _JSI_OPTSETNTYP(ldouble, nv, ptr); break;
case JSI_OPTION_FLOAT: _JSI_OPTSETNTYP(float, nv, ptr); break;
case JSI_OPTION_DOUBLE: _JSI_OPTSETNTYP(double, nv, ptr); break;
default: break;
}
isIncr = 0;
break;
case JSI_OPTION_STRKEY:
{
if (argValue == NULL || Jsi_ValueIsNull(interp, argValue))
*(const char**)ptr = NULL;
else {
const char *scp;
if (Jsi_GetStringFromValue(interp, argValue, &scp) != JSI_OK) {
return JSI_ERROR;
}
*(const char**)ptr = Jsi_KeyAdd(interp,scp);
}
}
break;
case JSI_OPTION_STRBUF:
{
if (argValue == NULL || Jsi_ValueIsNull(interp, argValue))
*(char*)ptr = 0;
else {
int sLen;
const char *scp = Jsi_ValueString(interp, argValue, &sLen);
if (!scp)
goto bail;
if (sLen>(int)(specPtr->size-1)) {
return Jsi_LogError("String too long");
//sLen = specPtr->size-1;
}
memcpy((char*)ptr, scp, sLen);
((char*)ptr)[sLen] = 0;
}
}
break;
#define _JSI_OPT_CHECKNULL(argValue) if (!argValue || Jsi_ValueIsNull(interp, argValue)) { \
if (*((Jsi_Value **)ptr)) \
Jsi_DecrRefCount(interp, *((Jsi_Value **)ptr)); \
*((Jsi_Value **)ptr) = NULL; \
break; \
}
#define _JSI_OPT_ARGSET(argValue, ptr) \
if (!(specPtr->flags&JSI_OPT_NO_DUPVALUE)) {\
Jsi_IncrRefCount(interp, argValue); \
if (*((Jsi_Value **)ptr)) Jsi_DecrRefCount(interp, *((Jsi_Value **)ptr)); \
}\
*((Jsi_Value **)ptr) = argValue;
case JSI_OPTION_STRING:
if (argValue == *((Jsi_Value **)ptr))
break;
_JSI_OPT_CHECKNULL(argValue);
if (!Jsi_ValueIsString(interp, argValue))
goto bail;
_JSI_OPT_ARGSET(argValue, ptr);
break;
case JSI_OPTION_DSTRING:
Jsi_DSInit((Jsi_DString *)ptr);
if (argValue && !Jsi_ValueIsNull(interp, argValue))
{
int sLen;
const char *scp = Jsi_ValueString(interp, argValue, &sLen);
if (!scp)
goto bail;
Jsi_DSAppendLen((Jsi_DString *)ptr, scp, sLen);
}
break;
case JSI_OPTION_TIME_D: {
if (argValue)
{
Jsi_Number nv = 0;
if (Jsi_ValueIsNumber(interp, argValue)) {
Jsi_GetNumberFromValue(interp, argValue, &nv);
*(double*)ptr = nv;
} else {
const char *scp;
if (Jsi_GetStringFromValue(interp, argValue, &scp) != JSI_OK) {
return JSI_ERROR;
}
if (JSI_OK != Jsi_DatetimeParse(interp, scp, "", 0, &nv, false))
return JSI_ERROR;
*(double*)ptr = nv;
}
} else {
*(double*)ptr = 0;
}
break;
}
case JSI_OPTION_TIME_W: {
if (argValue)
{
if (Jsi_ValueIsNumber(interp, argValue)) {
Jsi_GetNumberFromValue(interp, argValue, (Jsi_Number*)ptr);
} else {
const char *scp;
Jsi_Number num;
if (Jsi_GetStringFromValue(interp, argValue, &scp) != JSI_OK) {
return JSI_ERROR;
}
if (JSI_OK != Jsi_DatetimeParse(interp, scp, "", 0, &num, false))
return JSI_ERROR;
*(Jsi_Wide*)ptr = (Jsi_Wide)num;
}
} else {
*(Jsi_Wide*)ptr = 0;
}
break;
}
case JSI_OPTION_TIME_T: {
if (argValue)
{
if (Jsi_ValueIsNumber(interp, argValue)) {
Jsi_Number num;
Jsi_GetNumberFromValue(interp, argValue, &num);
*(time_t*)ptr = (time_t)num;
} else {
const char *scp;
if (Jsi_GetStringFromValue(interp, argValue, &scp) != JSI_OK) {
return JSI_ERROR;
}
Jsi_Number nval;
if (JSI_OK != Jsi_DatetimeParse(interp, scp, "", 0, &nval, false))
return JSI_ERROR;
*(time_t*)ptr = nval/1000LL;
}
} else {
*(time_t*)ptr = 0;
}
break;
}
case JSI_OPTION_VAR:
_JSI_OPT_CHECKNULL(argValue);
if (argValue->vt != JSI_VT_NULL && argValue->vt != JSI_VT_VARIABLE)
goto bail;
_JSI_OPT_ARGSET(argValue, ptr);
break;
case JSI_OPTION_FUNC:
_JSI_OPT_CHECKNULL(argValue);
if (argValue->vt != JSI_VT_OBJECT || argValue->d.obj->ot != JSI_OT_FUNCTION)
goto bail;
if (specPtr->data && (interp->typeCheck.run|interp->typeCheck.all))
if (!jsi_FuncArgCheck(interp, argValue->d.obj->d.fobj->func, (char*)specPtr->data))
return Jsi_LogError("failed setting func pointer for %s", specPtr->name);
_JSI_OPT_ARGSET(argValue, ptr);
break;
case JSI_OPTION_USEROBJ:
_JSI_OPT_CHECKNULL(argValue);
if (argValue->vt != JSI_VT_OBJECT || argValue->d.obj->ot != JSI_OT_USEROBJ)
goto bail;
if (specPtr->data && Jsi_Strcmp((char*)specPtr->data, argValue->d.obj->d.uobj->reg->name))
return Jsi_LogError("expected id %s for %s",(char*)specPtr->data, specPtr->name);
_JSI_OPT_ARGSET(argValue, ptr);
break;
case JSI_OPTION_REGEXP:
_JSI_OPT_CHECKNULL(argValue);
if (argValue->vt != JSI_VT_OBJECT || argValue->d.obj->ot != JSI_OT_REGEXP)
goto bail;
_JSI_OPT_ARGSET(argValue, ptr);
break;
case JSI_OPTION_OBJ:
_JSI_OPT_CHECKNULL(argValue);
if (argValue->vt != JSI_VT_OBJECT)
goto bail;
case JSI_OPTION_VALUE:
_JSI_OPT_CHECKNULL(argValue);
_JSI_OPT_ARGSET(argValue, ptr);
break;
case JSI_OPTION_ARRAY:
_JSI_OPT_CHECKNULL(argValue);
if (argValue->vt != JSI_VT_OBJECT || !argValue->d.obj->isarrlist)
goto bail;
_JSI_OPT_ARGSET(argValue, ptr);
break;
#ifdef __cplusplus
case JSI_OPTION_END:
#else
default:
#endif
Jsi_LogBug("invalid option id: %d", specPtr->id);
}
done:
specPtr->flags |= JSI_OPT_IS_SPECIFIED;
if (isIncr)
return Jsi_LogError("incr invalid for %s", specPtr->name);
return JSI_OK;
bail:
if (!emsg) {
emsg = jsi_OptTypeInfo[specPtr->id].cName;
epre = "expected ";
}
return Jsi_LogError("%s%s: for %s option \"%.40s\"", epre, emsg, (cust?cust->name:""), specPtr->name);
} | 58,199,542,844,487,130,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,813 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | jsonGenArray(Jsi_Interp *interp, Jsi_JsonParser *p, const char *js, uint pos, uint *endPos)
{
if (js==NULL || !js[0])
return NULL;
Jsi_Value *v = Jsi_ValueNewArray(interp, 0, 0);
Jsi_Obj *nobj = v->d.obj;
uint i, n;
Jsi_JsonTok *tok;
tok = p->tokens+pos;
Jsi_ValueMakeArrayObject(interp, &v, nobj);
for (i=pos+1, n=0; i<p->toknext && n<tok->size; i++, n++) {
if (n >= nobj->arrMaxSize) {
if (Jsi_ObjArraySizer(interp, nobj, n+1)<=0) {
break;
}
}
nobj->arr[n] = jsonGen1Value(interp, p, js, i, &i, 1);
}
Jsi_ObjSetLength(interp, nobj, n);
if (endPos)
*endPos = i;
return v;
} | 48,082,501,345,490,680,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,814 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | static Jsi_RC JSONCheckCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
int r;
Jsi_RC result = JSI_OK;
bool strict = 1;
const char *cp;
JSI_JSON_DECLARE(p, tokens, 0);
Jsi_Value *jsv = Jsi_ValueArrayIndex(interp, args, 1);
if (jsv && Jsi_ValueGetBoolean(interp, jsv, &strict) != JSI_OK)
return Jsi_LogError("Expected boolean");
p.strict = strict;
jsv = Jsi_ValueArrayIndex(interp, args, 0);
cp = Jsi_ValueToString(interp, jsv, NULL);
r = Jsi_JsonParse(&p, cp);
Jsi_ValueMakeBool(interp, ret, r == JSI_JSON_ERR_NONE);
Jsi_JsonFree(&p);
return result;
} | 46,496,026,222,492,180,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |
520,815 | jsish | 430ea27accd4d4ffddc946c9402e7c9064835a18 | https://github.com/pcmacdon/jsish | https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 0 | Jsi_Value *Jsi_ValueDup(Jsi_Interp *interp, Jsi_Value *v) {
return ValueDup(interp, v);
} | 124,853,056,616,404,780,000,000,000,000,000,000,000 | None | null | [
"CWE-120"
] | CVE-2020-22873 | Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code. | https://nvd.nist.gov/vuln/detail/CVE-2020-22873 |