project
stringclasses 633
values | commit_id
stringlengths 7
81
| target
int64 0
1
| func
stringlengths 5
484k
| cwe
stringclasses 131
values | big_vul_idx
float64 0
189k
⌀ | idx
int64 0
522k
| hash
stringlengths 34
39
| size
float64 1
24k
⌀ | message
stringlengths 0
11.5k
⌀ | dataset
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static char* jsi_FSRealPathProc(Jsi_Interp *interp, Jsi_Value *src, char *newPath) {
return Jsi_FileRealpath(interp, src, newPath);
}
|
CWE-120
| null | 520,086 |
44926772013369201580492377878961702474
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
int jsi_typeGet(Jsi_Interp *interp, const char *tname) {
if (!tname)
return 0;
if (Jsi_Strchr(tname, '|')) {
int argc, i, rc, val = 0;
char **argv;
Jsi_DString dStr;
Jsi_DSInit(&dStr);
Jsi_SplitStr(tname, &argc, &argv, "|", &dStr);
for (i=0; i<argc; i++) {
rc = jsi_typeGet(interp, argv[i]);
if (rc < 0)
break;
val |= rc;
}
Jsi_DSFree(&dStr);
if (i<argc)
return -1;
return val;
}
switch (tname[0]) {
case 'b': if (Jsi_Strcmp(tname, "boolean")==0) return JSI_TT_BOOLEAN; break;
case 's': if (Jsi_Strcmp(tname, "string")==0) return JSI_TT_STRING; break;
case 'n': if (Jsi_Strcmp(tname, "null")==0) return JSI_TT_NULL;
if (Jsi_Strcmp(tname, "number")==0) return JSI_TT_NUMBER; break;
case 'o': if (Jsi_Strcmp(tname, "object")==0) return JSI_TT_OBJECT; break;
case 'r': if (Jsi_Strcmp(tname, "regexp")==0) return JSI_TT_REGEXP; break;
case 'f': if (Jsi_Strcmp(tname, "function")==0) return JSI_TT_FUNCTION; break;
case 'i': if (Jsi_Strcmp(tname, "iterobj")==0) return JSI_TT_ITEROBJ;
case 'u': if (Jsi_Strcmp(tname, "userobj")==0) return JSI_TT_USEROBJ;
if (Jsi_Strcmp(tname, "undefined")==0) return JSI_TT_UNDEFINED; break;
case 'a': if (Jsi_Strcmp(tname, "array")==0) return JSI_TT_ARRAY;
if (Jsi_Strcmp(tname, "any")==0) return JSI_TT_ANY; break;
case 'v': if (Jsi_Strcmp(tname, "void")==0) return JSI_TT_VOID; break;
}
Jsi_LogWarn("Type \"%s\" is not one of boolean, string, number, function, array, object, regexp, userobj, null, undefined, void or any", tname);
return 0;
}
|
CWE-120
| null | 520,087 |
318640890731819920694065404531656407097
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC freeCodeTbl(Jsi_Interp *interp, Jsi_HashEntry *hPtr, void *ptr) {
jsi_Pstate *ps = (jsi_Pstate *)ptr;
if (!ps) return JSI_OK;
ps->hPtr = NULL;
jsi_PstateFree(ps);
return JSI_OK;
}
|
CWE-120
| null | 520,088 |
272199612750792718878881629935578369415
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static void jsiSetupStack(Jsi_Interp *interp)
{
int oldsz = interp->maxStack;
if (interp->maxStack)
interp->maxStack += STACK_INCR_SIZE;
else
interp->maxStack = STACK_INIT_SIZE;
_jsi_STACK = jsi_ValuesAlloc(interp, interp->maxStack, _jsi_STACK, oldsz);
_jsi_THIS = jsi_ValuesAlloc(interp, interp->maxStack, _jsi_THIS, oldsz); //TODO:!!! use interp->framePtr for this.
}
|
CWE-120
| null | 520,089 |
80934998121252491684521048155326131118
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
JSI_RC mycall(Jsi_Tree* treePtr, Jsi_TreeEntry* hPtr, void *data)
{
printf("CALL: %s(%d) : %d\n", (char*)Jsi_TreeKeyGet(hPtr), jsi_nodeDepth(hPtr), (int)Jsi_TreeValueGet(hPtr));
return JSI_OK;
}
|
CWE-120
| null | 520,090 |
60753647825256854499755402581477162633
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC StringTrimCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
return _StringTrimCmd(interp, args, _this, ret, funcPtr, 3);
}
|
CWE-120
| null | 520,091 |
156569678182903381445833946341746591819
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC InterpCallCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
InterpObj *udf = (InterpObj *)Jsi_UserObjGetData(interp, _this, funcPtr);
int isthrd;
Jsi_Interp *sinterp;
if (udf)
sinterp = udf->subinterp;
else
return Jsi_LogError("Apply Interp.call in a non-subinterp");
if (Jsi_InterpGone(sinterp))
return Jsi_LogError("Sub-interp gone");
isthrd = (interp->threadId != sinterp->threadId);
Jsi_Value *func = NULL;
char *fname = NULL;
func = Jsi_ValueArrayIndex(interp, args, 0);
fname = Jsi_ValueString(interp, func, NULL);
if (!fname)
return Jsi_LogError("function name must be a string");
if (Jsi_MutexLock(interp, sinterp->Mutex) != JSI_OK)
return JSI_ERROR;
Jsi_Value *namLU = Jsi_NameLookup(sinterp, fname);
Jsi_MutexUnlock(interp, sinterp->Mutex);
if (namLU == NULL)
return Jsi_LogError("unknown function: %s", fname);
Jsi_Value *arg = Jsi_ValueArrayIndex(interp, args, 1);
char *cp = Jsi_ValueString(interp, arg, NULL);
if (cp == NULL && !Jsi_ValueIsArray(interp, arg))
return Jsi_LogError("expected string or array");
Jsi_Value *vwait = Jsi_ValueArrayIndex(interp, args, 2);
Jsi_RC rc = JSI_OK;
bool wait = 0;
if (vwait && Jsi_GetBoolFromValue(interp, vwait, &wait))
return JSI_ERROR;
if (wait) {
Jsi_DString dStr = {};
if (cp == NULL)
cp = (char*)Jsi_ValueGetDString(interp, arg, &dStr, JSI_OUTPUT_JSON);
if (interp->subOpts.mutexUnlock) Jsi_MutexUnlock(interp, interp->Mutex);
if (Jsi_MutexLock(interp, sinterp->Mutex) != JSI_OK) {
if (interp->subOpts.mutexUnlock) Jsi_MutexLock(interp, interp->Mutex);
return JSI_ERROR;
}
Jsi_Value *srPtr = Jsi_ValueNew1(sinterp);
/* TODO: call from this interp may not be safe if threaded.
* Could instead use async code below then wait for unlock on se->mutex. */
rc = Jsi_CommandInvokeJSON(sinterp, fname, cp, &srPtr);
Jsi_DSSetLength(&dStr, 0);
Jsi_CleanValue(sinterp, interp, srPtr, ret);
//Jsi_ValueCopy(interp, *ret, srPtr);
Jsi_DecrRefCount(sinterp, srPtr);
Jsi_DSFree(&dStr);
Jsi_MutexUnlock(interp, sinterp->Mutex);
if (interp->subOpts.mutexUnlock && Jsi_MutexLock(interp, interp->Mutex) != JSI_OK) {
Jsi_LogBug("mutex re-get failed");
return JSI_ERROR;
}
return rc;
}
/* Post to thread event in sub-interps queue. */
if (Jsi_MutexLock(interp, sinterp->QMutex) != JSI_OK)
return JSI_ERROR;
/* Is an async call. */
InterpStrEvent *se, *s = (InterpStrEvent *)Jsi_Calloc(1, sizeof(*s));
// TODO: is s->data inited?
Jsi_DSInit(&s->data);
if (!cp) {
Jsi_ValueGetDString(interp, arg, &s->data, JSI_OUTPUT_JSON);
} else {
Jsi_DSSetLength(&s->data, 0);
Jsi_DSAppend(&s->data, cp, NULL);
}
Jsi_DSInit(&s->func);
Jsi_DSAppend(&s->func, fname, NULL);
se = sinterp->interpStrEvents;
if (!se)
sinterp->interpStrEvents = s;
else {
while (se->next)
se = se->next;
se->next = s;
}
Jsi_MutexUnlock(interp, sinterp->QMutex);
if (!isthrd) {
if (SubInterpEvalCallback(sinterp, NULL) != JSI_OK)
sinterp->threadErrCnt++;
}
return JSI_OK;
}
|
CWE-120
| null | 520,092 |
260011524774760272273582014993222472703
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_TreeEntry* sibling(Jsi_TreeEntry* n) {
Assert (n != NULL);
Assert (n->parent != NULL);
return (n == n->parent->left ? n->parent->right : n->parent->left);
}
|
CWE-120
| null | 520,093 |
38788661813737967687658775076721242175
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Value *jsi_ScopeChainObjLookupUni(jsi_ScopeChain *sc, char *key)
{
int i;
Jsi_Value *ret;
for (i = sc->chains_cnt - 1; i >= 0; --i) {
if ((ret = Jsi_ValueObjLookup(sc->interp, sc->chains[i], key, 0))) {
return ret;
}
}
return NULL;
}
|
CWE-120
| null | 520,094 |
216264326651157960580171928643562927412
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC FilesysSeekCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
static const char *posStr[] = { "set", "cur", "end", NULL };
enum { W_SET, W_CUR, W_END };
UdfGet(udf, _this, funcPtr);
Jsi_Value *vPos = Jsi_ValueArrayIndex(interp, args, 0);
Jsi_Value *vWhence = Jsi_ValueArrayIndex(interp, args, 1);
int mode = 0, p;
Jsi_Wide pos;
Jsi_Number num;
if (Jsi_ValueGetNumber(interp, vPos, &num) != JSI_OK)
return JSI_ERROR;
if (Jsi_ValueGetIndex(interp, vWhence, posStr, "position", 0, &p) != JSI_OK)
return JSI_ERROR;
switch (p) {
case W_SET: mode = SEEK_SET; break;
case W_CUR: mode = SEEK_CUR; break;
case W_END: mode = SEEK_END; break;
}
pos = (Jsi_Wide)num;
pos = Jsi_Seek(interp, udf->chan, pos, mode);
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)pos);
return JSI_OK;
}
|
CWE-120
| null | 520,095 |
17597125969154805487108579759593404809
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_Free(void *n) { Assert(n); free(n); }
|
CWE-120
| null | 520,096 |
44546155813943678028200290948236455623
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC StringCharCodeAtCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
int sLen, bLen;
const char *source_str;
ChkString(_this, funcPtr, source_str, &sLen, &bLen);
const char *v = source_str;
Jsi_Value *ttPtr = Jsi_ValueNew1(interp);
Jsi_ValueCopy(interp, ttPtr, _this);
int pos = 0;
Jsi_Value *vpos;
if ((vpos = Jsi_ValueArrayIndex(interp, args, skip))) {
jsi_ValueToOInt32(interp, vpos);
pos = (int)vpos->d.num;
}
#if JSI__UTF8
int m;
if (pos >= 0 && pos < sLen && ((m=Jsi_UtfIndexToOffset(v, pos))>=0)) {
int32_t n;
Jsi_UtfToUniChar(v+m, &n);
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)n);
}
#else
int slen = Jsi_Strlen(v);
if (pos >= 0 && pos < slen) {
Jsi_ValueMakeNumber(interp, ret, v[pos]);
}
#endif
else
Jsi_ValueMakeNumber(interp, ret, Jsi_NumberNaN());
Jsi_DecrRefCount(interp, ttPtr);
return JSI_OK;
}
|
CWE-120
| null | 520,097 |
266993653895602865185553105278037066297
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_HashDelete(Jsi_Hash *tablePtr)
{
Jsi_HashClear(tablePtr);
Jsi_Free(tablePtr);
}
|
CWE-120
| null | 520,098 |
321769669917986861924506804561857898594
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC NumberToStringCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
char buf[JSI_MAX_NUMBER_STRING+1];
int radix = 10, skip = 0, argc = Jsi_ValueGetLength(interp, args);
Jsi_Number num;
Jsi_Value *v;
ChkStringN(_this, funcPtr, v);
Jsi_GetDoubleFromValue(interp, v, &num);
if (argc>skip && (Jsi_GetIntFromValue(interp, Jsi_ValueArrayIndex(interp, args, skip), &radix) != JSI_OK
|| radix<2))
return JSI_ERROR;
if (argc==skip)
return jsi_ObjectToStringCmd(interp, args, _this, ret, funcPtr);
switch (radix) {
case 16: snprintf(buf, sizeof(buf), "%" PRIx64, (Jsi_Wide)num); break;
case 8: snprintf(buf, sizeof(buf), "%" PRIo64, (Jsi_Wide)num); break;
case 10: snprintf(buf, sizeof(buf), "%" PRId64, (Jsi_Wide)num); break;
default: return jsi_ObjectToStringCmd(interp, args, _this, ret, funcPtr);
}
Jsi_ValueMakeStringDup(interp, ret, buf);
return JSI_OK;
}
|
CWE-120
| null | 520,099 |
246733780820163232989985533975118759957
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
HashStringFind( Jsi_Hash *tablePtr, const void *key)
{
jsi_Hash hval;
Jsi_HashEntry *hPtr;
size_t hindex;
hval = HashString((char *)key);
hindex = hval & tablePtr->mask;
/*
* Search all of the entries in the appropriate bucket.
*/
for (hPtr = tablePtr->buckets[hindex]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
if (hPtr->hval == hval) {
const char *p1, *p2;
for (p1 = (char*)key, p2 = hPtr->key.string; ; p1++, p2++) {
if (*p1 != *p2) {
break;
}
if (*p1 == '\0') {
return hPtr;
}
}
}
}
return NULL;
}
|
CWE-120
| null | 520,100 |
228944223350319664198882849424425062799
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_TreeValueSet(Jsi_TreeEntry *hPtr, void *value)
{
Jsi_Value *v = (Jsi_Value*)value;
#if JSI__MEMDEBUG
SIGASSERTV(hPtr, TREEENTRY);
if (hPtr->treePtr->flags.valuesonly)
SIGASSERTV(v,VALUE);
#endif
hPtr->value = v;
}
|
CWE-120
| null | 520,101 |
284050825929523681828011940265331804703
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
const char *mysqlGetbindParamName(MysqlPrep* pStmt, int n) {
if (n>=1 && n<=pStmt->paramCnt)
return pStmt->paramNames[n-1];
return NULL;
}
|
CWE-120
| null | 520,102 |
236615824638206252358763897680514739190
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_OptionsFree(Jsi_Interp *interp, Jsi_OptionSpec *specs, void *rec, Jsi_Wide flags /*unused*/)
{
Jsi_OptionSpec *specPtr;
char *record = (char*)rec;
for (specPtr = specs; specPtr->id>=JSI_OPTION_BOOL && specPtr->id < JSI_OPTION_END && specPtr->name; specPtr++) {
char *ptr = record + specPtr->offset;
if (specPtr->flags&JSI_OPT_NO_CLEAR)
continue;
if (specPtr->custom) {
Jsi_OptionCustom* cust = Jsi_OptionCustomBuiltin(specPtr->custom);
if (cust->freeProc != NULL) {
(*cust->freeProc)(interp, specPtr, (char **)ptr);
continue;
}
}
switch (specPtr->id) {
#ifndef JSI_LITE_ONLY
case JSI_OPTION_VALUE:
case JSI_OPTION_STRING:
case JSI_OPTION_OBJ:
case JSI_OPTION_REGEXP:
case JSI_OPTION_ARRAY:
case JSI_OPTION_FUNC:
case JSI_OPTION_USEROBJ:
case JSI_OPTION_VAR:
{
Jsi_Value **vpp = (Jsi_Value**)ptr, *vPtr = *vpp;
if (vPtr && (!(specPtr->flags&JSI_OPT_NO_DUPVALUE)))
Jsi_DecrRefCount(interp, vPtr);
*vpp = 0;
break;
}
#endif
case JSI_OPTION_STRKEY:
*(char**)ptr = 0;
break;
case JSI_OPTION_STRBUF:
*(char*)ptr = 0;
break;
case JSI_OPTION_DSTRING:
Jsi_DSFree((Jsi_DString *)ptr);
break;
case JSI_OPTION_TIME_T:
*(time_t*)ptr = 0;
break;
case JSI_OPTION_NUMBER:
*(Jsi_Number*)ptr = 0;
break;
case JSI_OPTION_FLOAT:
*(float*)ptr = 0;
break;
case JSI_OPTION_LDOUBLE:
*(ldouble*)ptr = 0;
break;
case JSI_OPTION_DOUBLE:
case JSI_OPTION_TIME_D:
*(double*)ptr = 0;
break;
case JSI_OPTION_TIME_W:
*(Jsi_Wide*)ptr = 0;
break;
case JSI_OPTION_INT8: *(int8_t*)ptr = 0; break;
case JSI_OPTION_INT16: *(int16_t*)ptr = 0; break;
case JSI_OPTION_INT32: *(int32_t*)ptr = 0; break;
case JSI_OPTION_INT64: *(int64_t*)ptr = 0; break;
case JSI_OPTION_UINT8: *(uint8_t*)ptr = 0; break;
case JSI_OPTION_UINT16:*(uint16_t*)ptr = 0; break;
case JSI_OPTION_UINT32:*(uint32_t*)ptr = 0; break;
case JSI_OPTION_UINT64:*(uint64_t*)ptr = 0; break;
case JSI_OPTION_INT: *(int*)ptr = 0; break;
case JSI_OPTION_UINT: *(uint*)ptr = 0; break;
case JSI_OPTION_BOOL: *(bool*)ptr = 0; break;
case JSI_OPTION_CUSTOM:
break;
default:
if (specPtr->size>0)
memset(ptr, 0, specPtr->size);
break;
}
}
}
|
CWE-120
| null | 520,103 |
158013364595135293824203934382519798271
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Value *Jsi_ValueNewArray(Jsi_Interp *interp, const char **items, int count)
{
Jsi_Obj *obj = Jsi_ObjNewType(interp, JSI_OT_ARRAY);
int i = 0;
if (count<0) {
count = 0;
while (items[count])
count++;
}
if (Jsi_ObjArraySizer(interp, obj, count) <= 0) {
Jsi_ObjFree(interp, obj);
return NULL;
}
for (i = 0; i < count; ++i) {
obj->arr[i] = Jsi_ValueNewStringDup(interp, items[i]);
Jsi_IncrRefCount(interp, obj->arr[i]);
}
obj->arrCnt = count;
assert(obj->arrCnt<=obj->arrMaxSize);
return Jsi_ValueMakeArrayObject(interp, NULL, obj);
}
|
CWE-120
| null | 520,104 |
107618525811297815732677984101165342917
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static void jsi_wsOnModify(jsi_wsCmdObj *cmdPtr) {
if (!cmdPtr->stats.httpLast) return;
time_t now = time(NULL);
double dt = (difftime(now, cmdPtr->lastModifyCheck));
if (dt<0) {
cmdPtr->lastModifyCheck = now;
return;
}
uint secs = cmdPtr->modifySecs;
if (!secs) secs = 2;
if (dt<secs) return;
cmdPtr->lastModifyCheck = now;
Jsi_Interp *interp = cmdPtr->interp;
Jsi_HashEntry *hPtr;
Jsi_HashSearch cursor;
Jsi_Value* changed = NULL;
time_t ll = cmdPtr->lastModifyNotify;
if (ll<cmdPtr->stats.httpLast)
ll = cmdPtr->stats.httpLast;
for (hPtr = Jsi_HashSearchFirst(cmdPtr->fileHash, &cursor);
hPtr != NULL; hPtr = Jsi_HashSearchNext(&cursor)) {
jsi_wsFile* fPtr = (jsi_wsFile*)Jsi_HashValueGet(hPtr);
if (fPtr && fPtr->fileVal) {
Jsi_StatBuf sb;
int n = Jsi_Stat(interp, fPtr->fileVal, &sb);
if (!n && sb.st_mtime > ll) {
changed = fPtr->fileVal;
break;
}
}
}
cmdPtr->lastModifyCheck = time(NULL);
if (!changed) return;
Jsi_Obj *oarg1;
Jsi_Value *vpargs, *vargs[10];
int n = 0;
vargs[n++] = Jsi_ValueNewObj(interp, cmdPtr->fobj);
vargs[n++] = changed;
vpargs = Jsi_ValueMakeObject(interp, NULL, oarg1 = Jsi_ObjNewArray(interp, vargs, n, 0));
Jsi_IncrRefCount(interp, vpargs);
Jsi_Value *ret = Jsi_ValueNew1(interp);
Jsi_ValueMakeUndef(interp, &ret);
Jsi_RC rc = Jsi_FunctionInvoke(interp, cmdPtr->onModify, vpargs, &ret, NULL);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK) {
Jsi_LogWarn("websock bad onModify eval: disabling");
Jsi_DecrRefCount(interp, cmdPtr->onModify);
cmdPtr->onModify = NULL;
}
cmdPtr->lastModifyCheck = time(NULL);
cmdPtr->lastModifyNotify = time(NULL);
}
|
CWE-120
| null | 520,105 |
182813263009920267382829949785996409088
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static jsi_TryList *jsi_trylist_new(jsi_try_op_type t, jsi_ScopeChain *scope_save, Jsi_Value *curscope_save)
{
jsi_TryList *n = (jsi_TryList *)Jsi_Calloc(1,sizeof(*n));
n->type = t;
n->curscope_save = curscope_save;
/*Jsi_IncrRefCount(interp, curscope_save);*/
n->scope_save = scope_save;
return n;
}
|
CWE-120
| null | 520,106 |
176149591568104732360402103061005590337
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_ValueDup2(Jsi_Interp *interp, Jsi_Value **to, Jsi_Value *from )
{
if (!*to)
*to = Jsi_ValueNew1(interp);
#ifdef JSI_MEM_DEBUG
(*to)->VD.label3 = "ValueDup2";
#endif
Jsi_ValueCopy(interp, *to, from);
(*to)->f.bits.readonly = 0;
}
|
CWE-120
| null | 520,107 |
188406081071393512925632296265123581716
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
bool Jsi_ValueIsNull(Jsi_Interp *interp, Jsi_Value *pv)
{
return (pv->vt == JSI_VT_NULL);
}
|
CWE-120
| null | 520,108 |
128005756904174022482944954763718654659
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_ListEntry *Jsi_ListEntryNew(Jsi_List* list, const void *value, Jsi_ListEntry *before) {
SIGASSERT(list, LIST);
Jsi_ListEntry *l = (Jsi_ListEntry*)Jsi_Calloc(1, sizeof(Jsi_ListEntry));
l->sig = JSI_SIG_LISTENTRY;
l->typ = JSI_MAP_LIST;
l->list = list;
l->value = (void*)value;
Jsi_ListPush(list, l, before);
return l;
}
|
CWE-120
| null | 520,109 |
1610792631812809480325830177141376851
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void* Jsi_ListValueGet(Jsi_ListEntry *l) {
SIGASSERT(l, LISTENTRY);
return l?l->value:NULL;
}
|
CWE-120
| null | 520,110 |
170810119306161728348829364702289215888
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
bool Jsi_NumberIsInteger(Jsi_Number n) { return (isnormal(n) ? (Jsi_Number)((Jsi_Wide)(n)) == (n) : n==0.0); }
|
CWE-120
| null | 520,111 |
300412537452470165742223666811228415570
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static int jsi_FSReadlinkProc(Jsi_Interp *interp, Jsi_Value *path, char *buf, int size) {
const char *pathPtr = Jsi_ValueToString(interp, path, NULL);
Jsi_DString dStr = {};
if (*pathPtr == '~')
pathPtr = jsi_TildePath(interp, pathPtr, &dStr);
int rc = readlink(pathPtr, buf, size);
Jsi_DSFree(&dStr);
return rc;
}
|
CWE-120
| null | 520,112 |
69742220206235750996127390605659126857
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC Jsi_GetIntFromValue(Jsi_Interp* interp, Jsi_Value *value, int *n)
{
if (!Jsi_ValueIsNumber(interp, value))
return Jsi_LogError("invalid number");
return Jsi_GetIntFromValueBase(interp, value, n, 0, 0);
}
|
CWE-120
| null | 520,113 |
51350028570146646926115114477204859415
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void *Jsi_InterpGetData(Jsi_Interp *interp, const char *key, Jsi_DeleteProc **proc)
{
Jsi_HashEntry *hPtr;
AssocData *ptr;
hPtr = Jsi_HashEntryFind(interp->assocTbl, key);
if (!hPtr)
return NULL;
ptr = (AssocData *)Jsi_HashValueGet(hPtr);
if (!ptr)
return NULL;
if (proc)
*proc = ptr->delProc;
return ptr->data;
}
|
CWE-120
| null | 520,114 |
66839548253721388698345902690150931369
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static void dbReleaseStmt(
Jsi_Db *jdb, /* Database handle */
SqlPreparedStmt *pPreStmt, /* Prepared statement handle to release */
int discard /* True to delete (not cache) the pPreStmt */
) {
//int i;
//Jsi_Interp *interp = jdb->interp;
/* Free the bound string and blob parameters */
/*for(i=0; i<pPreStmt->nParm; i++) {
Jsi_DecrRefCount(interp, pPreStmt->apParm[i]);
}*/
//pPreStmt->nParm = 0;
if( jdb->stmtCacheMax<=0 || discard ) {
/* If the cache is turned off, deallocated the statement */
dbPrepStmtFree(jdb, pPreStmt);
} else {
/* Add the prepared statement to the beginning of the cache list, then limit. */
if (!pPreStmt->elPtr)
pPreStmt->elPtr = Jsi_ListPushFrontNew(jdb->stmtCache, pPreStmt);
else
Jsi_ListPushFront(jdb->stmtCache, pPreStmt->elPtr);
dbPrepStmtLimit(jdb);
jdb->stmtCacheCnt = Jsi_ListSize(jdb->stmtCache);
}
}
|
CWE-120
| null | 520,115 |
232678671544951430795131787769025617080
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_InterpDelete(Jsi_Interp* interp)
{
if (interp->deleting || interp->level > 0 || !interp->onDeleteTbl)
return;
interp->deleting = 1;
Jsi_HashDelete(interp->onDeleteTbl);
interp->onDeleteTbl = NULL;
Jsi_EventuallyFree(interp, interp, jsiInterpDelete);
}
|
CWE-120
| null | 520,116 |
85640820281256380591957122975054791093
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC Jsi_EvalString(Jsi_Interp* interp, const char *str, int flags)
{
int lev = interp->framePtr->level;
return jsi_evalStrFile(interp, NULL, (char*)str, flags, lev);
}
|
CWE-120
| null | 520,117 |
138300401224028535243113755178878913682
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Number Jsi_NumberInfinity(int i)
{
Jsi_Number r = INFINITY;
if (i < 0) r = -r;
return r;
}
|
CWE-120
| null | 520,118 |
276935515972189918030100274368767287119
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void jsi_FilesysDone(Jsi_Interp *interp)
{
Jsi_UserObjUnregister(interp, &fileobject);
Jsi_InitZvfs(interp, 1);
while (jsiFSList != NULL) {
FSList *fsPtr = jsiFSList;
jsiFSList = fsPtr->next;
if (fsPtr)
Jsi_Free(fsPtr);
}
}
|
CWE-120
| null | 520,119 |
175052322753084334881829054882338067499
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_OpCodes *code_eequ() { JSI_NEW_CODES(0,OP_STRICTEQU, 0); }
|
CWE-120
| null | 520,120 |
336874271315188646909796374062305262759
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC FilesysConstructor(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_Value *that = _this;
if (!Jsi_FunctionIsConstructor(funcPtr)) {
Jsi_Obj *o = Jsi_ObjNew(interp);
Jsi_PrototypeObjSet(interp, "File", o);
Jsi_ValueMakeObject(interp, ret, o);
that = *ret;
}
FileObj *fobj = (FileObj *)Jsi_Calloc(1,sizeof(*fobj));
SIGINIT(fobj, FILEOBJ);
if (try_open_file(interp, fobj, args) != JSI_OK) { /* Error out on open fail */
Jsi_Free(fobj);
return JSI_ERROR;
}
Jsi_Obj *nobj = (Jsi_Obj*)Jsi_ValueGetObj(interp, that);
fobj->objId = Jsi_UserObjNew(interp, &fileobject, nobj, fobj);
if (fobj->objId<0) {
Jsi_Free(fobj); // TODO: finish cleanup
return JSI_ERROR;
}
fobj->fobj = nobj;
return JSI_OK;
}
|
CWE-120
| null | 520,121 |
162391056818904966572985117293957567439
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC StringIndexOfCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
int sLen, bLen;
const char *v;
ChkString(_this, funcPtr, v, &sLen, &bLen);
Jsi_Value *seq = Jsi_ValueArrayIndex(interp, args, skip);
Jsi_Value *start = Jsi_ValueArrayIndex(interp, args, skip+1);
if (!seq) {
Jsi_ValueMakeNumber(interp,ret, -1);
return JSI_OK;
}
const char *vseq = Jsi_ValueToString(interp, seq, NULL);
int istart = 0;
if (start) {
if (Jsi_GetIntFromValue(interp, start, &istart)) {
return JSI_ERROR;
}
if (istart < 0) istart = 0;
}
int r = Jsi_Strpos(v, istart, vseq, 0);
Jsi_ValueMakeNumber(interp, ret, r);
return JSI_OK;
}
|
CWE-120
| null | 520,122 |
12906632758063219808905725964132925807
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC WebSocketUpdateCmd(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 to non-websock object");
if (!cmdPtr->noUpdate)
jsi_wsService(cmdPtr);
return JSI_OK;
}
|
CWE-120
| null | 520,123 |
273700974527398993953407037932251397916
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
const char *jsi_TypeName(Jsi_Interp *interp, Jsi_ttype otyp)
{
switch (otyp) {
case JSI_TT_NUMBER: return "number";
case JSI_TT_STRING: return "string";
case JSI_TT_BOOLEAN: return "boolean";
case JSI_TT_ARRAY: return "array";
case JSI_TT_FUNCTION: return "function";
case JSI_TT_OBJECT: return "object";
case JSI_TT_REGEXP: return "regexp";
case JSI_TT_ANY: return "any";
case JSI_TT_USEROBJ: return "userobj";
case JSI_TT_ITEROBJ: return "iterobj";
case JSI_TT_UNDEFINED: return "undefined";
case JSI_TT_VOID: return "void";
case JSI_TT_NULL: return "null";
}
return "undefined";
}
|
CWE-120
| null | 520,124 |
313101394990939070412393395341591843549
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
int jsi_treeHeight(Jsi_TreeEntry* hPtr, int n)
{
int l = -1, r = -1;
if (hPtr->right == NULL && hPtr->right == NULL )
return n;
if (hPtr->left)
l = jsi_treeHeight(hPtr->left, n+1);
if (hPtr->right)
r = jsi_treeHeight(hPtr->right, n+1);
return (r > l ? r : l);
}
|
CWE-120
| null | 520,125 |
323042118761189599007718145004940349390
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC SysTimesCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_RC rc = JSI_OK;
int i, n=1, argc = Jsi_ValueGetLength(interp, args);
Jsi_Value *func = Jsi_ValueArrayIndex(interp, args, 0);
if (Jsi_ValueIsBoolean(interp, func)) {
bool bv;
if (argc != 1)
return Jsi_LogError("bool must be only arg");
Jsi_GetBoolFromValue(interp, func, &bv);
double now = jsi_GetTimestamp();
if (bv)
interp->timesStart = now;
else {
char buf[JSI_MAX_NUMBER_STRING];
snprintf(buf, sizeof(buf), " (times = %.6f sec)\n", (now-interp->timesStart));
Jsi_Puts(interp, jsi_Stderr, buf, -1);
}
Jsi_ValueMakeNumber(interp, ret, 0);
return JSI_OK;
}
Jsi_Wide diff, start, end;
if (!Jsi_ValueIsFunction(interp, func))
return Jsi_LogError("arg1: expected function|bool");
if (argc > 1 && Jsi_GetIntFromValue(interp, Jsi_ValueArrayIndex(interp, args, 1), &n) != JSI_OK)
return JSI_ERROR;
if (n<=0)
return Jsi_LogError("count not > 0: %d", n);
struct timeval tv;
gettimeofday(&tv, NULL);
start = (Jsi_Wide) tv.tv_sec * 1000000 + tv.tv_usec;
for (i=0; i<n && rc == JSI_OK; i++) {
rc = Jsi_FunctionInvoke(interp, func, NULL, ret, NULL);
}
gettimeofday(&tv, NULL);
end = (Jsi_Wide) tv.tv_sec * 1000000 + tv.tv_usec;
diff = (end - start);
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)diff);
return rc;
}
|
CWE-120
| null | 520,126 |
179546837921833347586495283266308904585
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
bool Jsi_HashUnset(Jsi_Hash *tbl, const void *key) {
Jsi_HashEntry *hPtr;
hPtr = Jsi_HashEntryFind(tbl, key);
if (!hPtr)
return false;
Jsi_HashEntryDelete(hPtr);
return true;
}
|
CWE-120
| null | 520,127 |
55146636659493493081636413504305917123
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
bool Jsi_ValueIsArray(Jsi_Interp *interp, Jsi_Value *v) {
return (v->vt == JSI_VT_OBJECT && v->d.obj->ot == JSI_OT_OBJECT && v->d.obj->isarrlist);
}
|
CWE-120
| null | 520,128 |
274377322251436454117825427855962195654
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
int jsi_nodeDepth(Jsi_TreeEntry* hPtr) {
int d = 0;
while (hPtr->parent != NULL) {
d++;
hPtr = hPtr->parent;
}
return d;
}
|
CWE-120
| null | 520,129 |
225117596873157825777528333501241281505
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
uint Jsi_MapSize(Jsi_Map *mapPtr) {
SIGASSERT(mapPtr, MAP);
switch (mapPtr->typ) {
case JSI_MAP_HASH: return Jsi_HashSize(mapPtr->v.hash);
case JSI_MAP_TREE: return Jsi_TreeSize(mapPtr->v.tree);
case JSI_MAP_LIST: return Jsi_ListSize(mapPtr->v.list);
case JSI_MAP_NONE: break;
}
return -1;
}
|
CWE-120
| null | 520,130 |
267734520483165570053635657826672296846
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void jsi_FuncFree(Jsi_Interp *interp, Jsi_Func *func)
{
if (--func->refCnt > 0)
return;
jsi_PkgInfo *pkg = func->pkg;
bool profile = (interp->profile || (pkg?pkg->popts.modConf.profile:0)),
cover = (interp->coverage || (pkg?pkg->popts.modConf.coverage:0));
if (profile || cover) {
Jsi_DString dStr;
Jsi_DSInit(&dStr);
const char *file = func->script;
if (!file)
file = "";
int line = func->bodyline.last_line;
if (!func->callCnt) {
if (cover && func->type == FC_NORMAL && func->name)
Jsi_DSPrintf(&dStr, "COVERAGE: func=%s file=%s:%d cover=0%%\n", func->name, file, line );
} else {
char buf[JSI_BUFSIZ];
if (func->type == FC_BUILDIN) {
const char *fnam = func->parentName;
snprintf(buf, sizeof(buf), "cmd=%s%s%s", fnam, fnam[0]?".":"", func->name);
interp->cmdSelfTime += (func->allTime-func->subTime);
} else {
double coverage = 0; // Calculate hits/all.
if (func->opcodes && func->opcodes->code_len>0) {
int i, cchit=0, ccall=0, ccline=0, cchitline=0;
Jsi_OpCodes *oc = func->opcodes;
for (i=0; i<oc->code_len; i++) {
if (oc->codes[i].Line<=0) continue;
if (ccline != oc->codes[i].Line) {
ccline = oc->codes[i].Line;
ccall++;
interp->coverAll++;
}
if (cchitline != oc->codes[i].Line && oc->codes[i].hit) {
cchitline = oc->codes[i].Line;
cchit++;
interp->coverHit++;
}
}
if (ccall)
coverage = (int)(100.0*cchit/ccall);
if (cover && cchit<ccall) { // Generate the misses list.
char cbuf[JSI_BUFSIZ];
int lastout = 0, lastpos=0, dupcnt=0, cccnt=0;
cbuf[0] = 0;
ccline=cchitline=0;
for (i=0; i<oc->code_len; i++) {
int ismiss = 0;
if (i==oc->code_len) {
ismiss = (ccline>0 && cchitline != ccline);
} else {
if (oc->codes[i].Line<=0) continue;
ismiss = (ccline>0 && ccline != oc->codes[i].Line && cchitline != ccline);
}
if (ismiss) {
cccnt++;
const char *sep = (cccnt>1?",":"");
if (lastout && (lastout+1)==ccline) {
sep = "-";
dupcnt++;
if (dupcnt>1)
cbuf[lastpos]=0; // Inefficient, but reliable.
else
lastpos = Jsi_Strlen(cbuf);
} else
dupcnt = 0;
int cbl = Jsi_Strlen(cbuf);
snprintf(cbuf+cbl, sizeof(cbuf)-cbl, "%s%d", sep, ccline);
lastout = ccline;
}
ccline = oc->codes[i].Line;
if (oc->codes[i].hit)
cchitline = ccline;
}
Jsi_DSPrintf(&dStr, "COVERAGE: func=%s file=%s:%d cover=%2.1f%% hits=%d, all=%d, misses=%s\n",
func->name, file, line, coverage, cchit, ccall, cbuf);
}
}
snprintf(buf, sizeof(buf), "cover=%#5.1f%% func=%s file=%s:%d", coverage, func->name, file, line);
interp->funcSelfTime += (func->allTime-func->subTime);
}
if (profile)
Jsi_DSPrintf(&dStr, "PROFILE: self=%6.6f all=%6.6f #calls=%-8d self/call=%6.6f all/call=%6.6f %s %s%s\n",
(func->allTime-func->subTime), (double)(func->allTime), func->callCnt,
(double)(func->allTime-func->subTime)/func->callCnt, (double)(func->allTime)/func->callCnt,
buf, interp->parent?" ::":"", (interp->parent&&interp->name?interp->name:""));
}
if (Jsi_DSLength(&dStr))
Jsi_Puts(interp, jsi_Stderr, Jsi_DSValue(&dStr), -1);
Jsi_DSFree(&dStr);
}
if (func->opcodes)
jsi_FreeOpcodes(func->opcodes);
if (func->hPtr)
Jsi_HashEntryDelete(func->hPtr);
if (func->localnames)
jsi_ScopeStrsFree(interp, func->localnames);
if (func->argnames)
jsi_ScopeStrsFree(interp, func->argnames);
if (func->cmdSpec && (intptr_t)func->cmdSpec->reserved[3]& 0x1)
Jsi_Free(func->cmdSpec);
_JSI_MEMCLEAR(func);
Jsi_Free(func);
interp->funcCnt--;
}
|
CWE-120
| null | 520,131 |
305278645165552683316463209460863629975
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_StackPush(Jsi_Stack *stack, void *element)
{
int neededLen = stack->len + 1;
if (neededLen > stack->maxlen) {
stack->maxlen = neededLen < 20 ? 20 : neededLen * 2;
stack->vector = (void**)Jsi_Realloc(stack->vector, sizeof(void *) * stack->maxlen);
}
stack->vector[stack->len] = element;
stack->len++;
}
|
CWE-120
| null | 520,132 |
185716014563622035346819090859574481790
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Value* Jsi_ValueNewObj(Jsi_Interp *interp, Jsi_Obj *o) {
Jsi_Value *v = Jsi_ValueNew(interp);
Jsi_ValueMakeObject(interp, &v, o);
return v;
}
|
CWE-120
| null | 520,133 |
1967520945707366668860174197927000869
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
char *jsi_TrimStr(char *str) {
while (isspace(*str)) str++;
if (!str) return str;
int len = Jsi_Strlen(str);
while (--len>=0 && isspace(str[len]))
str[len] = 0;
return str;
}
|
CWE-120
| null | 520,134 |
256805109756883218738038291735590778740
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
int Jsi_Printf(Jsi_Interp *interp, Jsi_Channel chan, const char *fmt, ...)
{
va_list va;
int n;
FILE *fp = (chan && chan->fp ? chan->fp : stdout);
va_start(va,fmt);
n = vfprintf(fp, fmt, va);
va_end(va);
return n;
}
|
CWE-120
| null | 520,135 |
132625269326027067078584830050194039587
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_Preserve(Jsi_Interp* interp, void *data) {
bool isNew;
PreserveData *ptr;
Jsi_HashEntry *hPtr = Jsi_HashEntryNew(interp->preserveTbl, data, &isNew);
assert(hPtr);
if (!isNew) {
ptr = (PreserveData*)Jsi_HashValueGet(hPtr);
if (ptr) {
assert(interp == ptr->interp);
ptr->refCnt++;
}
} else {
ptr = (PreserveData*)Jsi_Calloc(1,sizeof(*ptr));
Jsi_HashValueSet(hPtr, ptr);
ptr->interp = interp;
ptr->data = data;
ptr->refCnt = 1;
}
}
|
CWE-120
| null | 520,136 |
167810350699804898066609926295091948337
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static int jsi_do_throw(Jsi_Interp *interp, jsi_Pstate *ps, jsi_OpCode **ipp, jsi_TryList **tlp,
jsi_ScopeChain **scope, Jsi_Value **currentScope, int *context_id, Jsi_Value *top, const char *nam) {
if (Jsi_InterpGone(interp))
return JSI_ERROR;
jsi_TryList *trylist = *tlp;
while (1) {
if (trylist == NULL) {
const char *str = (top?Jsi_ValueString(interp, top, NULL):"");
if (str) {
if (!Jsi_Strcmp(nam, "help"))
Jsi_LogError("...%s", str);
else
Jsi_LogError("%s: %s", nam, str);
}
return JSI_ERROR;
}
if (trylist->type == jsi_TL_TRY) {
int n = interp->framePtr->Sp - trylist->d.td.tsp;
jsiPop(interp, n);
if (*ipp >= trylist->d.td.tstart && *ipp < trylist->d.td.tend) {
*ipp = trylist->d.td.cstart - 1;
break;
} else if (*ipp >= trylist->d.td.cstart && *ipp < trylist->d.td.cend) {
trylist->d.td.last_op = jsi_LOP_THROW;
*ipp = trylist->d.td.fstart - 1;
break;
} else if (*ipp >= trylist->d.td.fstart && *ipp < trylist->d.td.fend) {
jsi_pop_try(interp, tlp);
trylist = *tlp;
} else Jsi_LogBug("Throw within a try, but not in its scope?");
} else {
jsi_restore_scope(interp, ps, trylist, scope, currentScope, context_id);
jsi_pop_try(interp, tlp);
trylist = *tlp;
}
}
return JSI_OK;
}
|
CWE-120
| null | 520,137 |
5726594223479401694561927170209472080
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC Jsi_FuncObjToString(Jsi_Interp *interp, Jsi_Func *f, Jsi_DString *dStr, int flags)
{
int withBody = flags&1;
int withTypes = flags&2;
int withJSON = flags&4;
int withFull = (flags&8 && !withJSON);
if (withFull && f->type == FC_NORMAL && f->opcodes) {
int len;
const char *cp = jsi_FuncGetCode(interp, f, &len);
if (cp) {
Jsi_DSAppendLen(dStr,cp, len);
return JSI_OK;
}
}
Jsi_CmdSpec *spec = f->cmdSpec;
if (withJSON)
Jsi_DSAppend(dStr, "\"", NULL);
if (f->type == FC_NORMAL) {
Jsi_DSAppend(dStr, "function ", f->name?f->name:"", "(", NULL);
jsi_FuncArgsToString(interp, f, dStr, withTypes);
Jsi_DSAppend(dStr, ")", NULL);
if (withTypes && f->retType) {
Jsi_DString tStr;
Jsi_DSInit(&tStr);
Jsi_DSAppend(dStr, ":", jsi_typeName(interp, f->retType, &tStr), NULL);
Jsi_DSFree(&tStr);
}
if (withBody)
Jsi_DSAppend(dStr, " {...}", NULL);
} else {
Jsi_DSAppend(dStr, "function ", f->name?f->name:"", "(",
(spec&&spec->argStr)?spec->argStr:"", ")", NULL);
if (withBody)
Jsi_DSAppend(dStr, " { [native code] }", NULL);
}
if (withJSON)
Jsi_DSAppend(dStr, "\"", NULL);
return JSI_OK;
}
|
CWE-120
| null | 520,138 |
278738838606547177499467646486747953028
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static int jsi_FSReadProc(Jsi_Channel chan, char *buf, int size) {
return fread(buf, 1, size, _JSI_GETFP(chan,0));
}
|
CWE-120
| null | 520,139 |
52353601934335788530874384686081017276
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_OptionsProcess(Jsi_Interp *interp, Jsi_OptionSpec *specs, void *rec, Jsi_Value *args, Jsi_Wide flags)
{
Jsi_OptionSpec *specPtr;
int count = 0;
char *record = (char*)rec;
Jsi_TreeEntry *tPtr;
Jsi_TreeSearch search;
Jsi_Obj *to;
bool isSafe = interp->isSafe;
if (!Jsi_OptionsValid(interp, specs))
return -1;
if (interp->subOpts.compat && !(flags&JSI_OPTS_FORCE_STRICT))
flags |= JSI_OPTS_IGNORE_EXTRA;
specs = jsi_GetCachedOptionSpecs(interp, specs);
if (args == NULL || args->vt == JSI_VT_NULL) {
for (specPtr = specs; specPtr->id>=JSI_OPTION_BOOL && specPtr->id < JSI_OPTION_END && specPtr->name; specPtr++) {
specPtr->flags &= ~JSI_OPT_IS_SPECIFIED;
if (jsi_SetOption(interp, specPtr, (char*)specPtr->name, record, NULL, flags, isSafe) != JSI_OK)
return -1;
}
assert(specPtr->id == JSI_OPTION_END);
return 0;
}
if (args->vt != JSI_VT_OBJECT || args->d.obj->ot != JSI_OT_OBJECT || args->d.obj->arr) {
Jsi_LogError("expected object");
return -1;
}
to = args->d.obj;
int reqCnt = 0;
if ((JSI_OPTS_IS_UPDATE&flags)==0 && !(JSI_OPT_PASS2&flags)) {
for (specPtr = specs; specPtr->id>=JSI_OPTION_BOOL && specPtr->id < JSI_OPTION_END && specPtr->name; specPtr++) {
specPtr->flags &= ~JSI_OPT_IS_SPECIFIED;
if (specPtr->flags & JSI_OPT_REQUIRED)
reqCnt++;
}
assert(specPtr->id == JSI_OPTION_END);
}
for (tPtr = Jsi_TreeSearchFirst(to->tree, &search, 0, NULL);
tPtr != NULL; tPtr = Jsi_TreeSearchNext(&search)) {
const char *arg;
Jsi_Value *optval;
count++;
arg =(char*) Jsi_TreeKeyGet(tPtr);
optval = (Jsi_Value*)Jsi_TreeValueGet(tPtr);
specPtr = Jsi_OptionsFind(interp, specs, arg, flags);
if (specPtr == NULL) {
if (flags&JSI_OPTS_IGNORE_EXTRA)
continue;
count = -1;
goto done;
}
if (((JSI_OPT_PASS2&flags) && !(JSI_OPT_PASS2&specPtr->flags))
|| ((JSI_OPT_PASS2&specPtr->flags) && !(JSI_OPT_PASS2&flags)))
continue;
if ((JSI_OPT_READ_ONLY&specPtr->flags)) {
Jsi_LogError("Error option is readonly: \"%.40s\"", specPtr->name);
count = -1;
goto done;
}
if ((JSI_OPTS_IS_UPDATE&flags) && (JSI_OPT_INIT_ONLY&specPtr->flags)) {
Jsi_LogError("Error can not update option: \"%.40s\"", specPtr->name);
count = -1;
goto done;
}
if (isSafe && (JSI_OPTS_IS_UPDATE&flags) && (JSI_OPT_LOCKSAFE&specPtr->flags)) {
Jsi_LogError("Error isSafe disallows updating option: \"%.40s\"", specPtr->name);
count = -1;
goto done;
}
if (jsi_SetOption(interp, specPtr, (char*)arg, record, optval, flags, isSafe) != JSI_OK) {
count = -1;
goto done;
}
specPtr->flags |= JSI_OPT_IS_SPECIFIED;
}
if (reqCnt) {
for (specPtr = specs; specPtr->id>=JSI_OPTION_BOOL && specPtr->id < JSI_OPTION_END && specPtr->name; specPtr++) {
if (specPtr->flags & JSI_OPT_REQUIRED &&
!(specPtr->flags&JSI_OPT_IS_SPECIFIED)) {
Jsi_LogError("Error required field not specified: \"%.40s\"", specPtr->name);
count = -1;
}
}
}
done:
Jsi_TreeSearchDone(&search);
if (count<0 && !(JSI_OPTS_IS_UPDATE&flags))
Jsi_OptionsFree(interp, specs, rec, flags);
return count;
}
|
CWE-120
| null | 520,140 |
273815011898358381082412318871039683607
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC Jsi_GetDoubleFromValue(Jsi_Interp* interp, Jsi_Value *value, Jsi_Number *n)
{
if (!value)
return JSI_ERROR;
if (!interp->strict)
Jsi_ValueToNumber(interp, value);
if (!Jsi_ValueIsNumber(interp, value))
return Jsi_LogError("invalid number");
*n = (value->vt == JSI_VT_NUMBER ? value->d.num : value->d.obj->d.num);
return JSI_OK;
}
|
CWE-120
| null | 520,141 |
271681854435616004337393548732823180065
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Value* jsi_ValueSubscript(Jsi_Interp *interp, Jsi_Value *target, Jsi_Value *key, Jsi_Value **ret)
{
int len;
Jsi_ValueReset(interp, ret);
Jsi_Value *v = jsi_ValueLookupBase(interp, target, key, ret);
if (v)
return v;
const char *keyStr = Jsi_ValueString(interp, key, NULL);
if (!keyStr)
return NULL;
// Special cases such as "length", "constructor", etc...
if (Jsi_Strcmp(keyStr,"length")==0) {
if (Jsi_ValueIsString(interp, target)) {
len = Jsi_ValueStrlen(target);
} else if (target->vt == JSI_VT_OBJECT && target->d.obj->isarrlist) {
len = target->d.obj->arrCnt;
} else if (target->vt == JSI_VT_OBJECT && target->d.obj->ot == JSI_OT_FUNCTION) {
Jsi_Func *fo = target->d.obj->d.fobj->func;
if (fo->type == FC_NORMAL)
len = fo->argnames->count;
else
len = fo->cmdSpec->maxArgs, len = (len>=0?len:fo->cmdSpec->minArgs);
} else if (target->vt == JSI_VT_OBJECT && target->d.obj->tree) {
len = target->d.obj->tree->numEntries;
} else {
return NULL;
}
(*ret)->vt = JSI_VT_NUMBER;
(*ret)->d.num = (Jsi_Number)len;
return *ret;
}
if (target->vt == JSI_VT_OBJECT && (interp->subOpts.noproto==0 && Jsi_Strcmp(keyStr,"constructor")==0)) {
const char *cp;
Jsi_Obj *o = target->d.obj->constructor;
if (o) {
if (o->ot == JSI_OT_FUNCTION) {
Jsi_Value *proto = Jsi_TreeObjGetValue(o, "prototype", 0);
if (proto && proto->vt == JSI_VT_OBJECT && proto->d.obj->constructor) {
o = proto->d.obj->constructor;
}
}
} else {
switch(target->d.obj->ot) {
case JSI_OT_NUMBER:
cp = "Number";
break;
case JSI_OT_BOOL:
cp = "Boolean";
break;
case JSI_OT_STRING:
cp = "String";
break;
case JSI_OT_REGEXP:
cp = "RegExp";
break;
case JSI_OT_OBJECT:
if (target->d.obj->isarrlist) {
cp = "Array";
break;
}
cp = "Object";
break;
default:
Jsi_ValueMakeUndef(interp, ret);
return *ret;
}
v = Jsi_ValueObjLookup(interp, interp->csc, cp, 0);
if (v==NULL || v->vt != JSI_VT_OBJECT)
return NULL;
o = target->d.obj->constructor = v->d.obj;
}
Jsi_ValueMakeObject(interp, ret, o);
return *ret;
}
if (target->vt == JSI_VT_OBJECT && target->d.obj->ot == JSI_OT_FUNCTION) {
/* Looking up something like "String.substr" */
Jsi_Func* func = target->d.obj->d.fobj->func;
if (func->type == FC_BUILDIN) {
if (func->f.bits.iscons && func->name) {
Jsi_Value *v = Jsi_ValueObjLookup(interp, interp->csc, (char*)func->name, 0);
if (!v) {
} else {
bool ooo = interp->subOpts.noproto;
interp->subOpts.noproto = 0;
v = Jsi_ValueObjLookup(interp, v, "prototype", 0);
interp->subOpts.noproto = ooo;
if (v && ((v = Jsi_ValueObjLookup(interp, v, (char*)keyStr, 0)))) {
if (v->vt == JSI_VT_OBJECT && v->d.obj->ot == JSI_OT_FUNCTION && Jsi_Strcmp(func->name,"Interp")) {
Jsi_Func* sfunc = v->d.obj->d.fobj->func;
/* Handle "Math.pow(2,3)", "String.fromCharCode(0x21)", ... */
sfunc->callflags.bits.addargs = 1;
}
return v;
}
}
}
if (Jsi_ValueIsString(interp, key)) {
char *kstr = Jsi_ValueString(interp, key, NULL);
if (!Jsi_Strcmp(kstr,"call") || !Jsi_Strcmp(kstr,"apply") || !Jsi_Strcmp(kstr,"bind")) {
char fbuf[JSI_MAX_NUMBER_STRING];
snprintf(fbuf, sizeof(fbuf), "Function.%s", kstr);
Jsi_Value *vv = Jsi_NameLookup(interp, fbuf);
if (vv)
return vv;
}
}
}
}
return NULL;
}
|
CWE-120
| null | 520,142 |
123065335820446375289985768161160320952
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_OpCodes *codes_new(int size)
{
Jsi_OpCodes *ops = (Jsi_OpCodes *)Jsi_Calloc(1, sizeof(*ops));
jsiOpCodesCnt[0]++;
jsiOpCodesCnt[2]++;
ops->codes = (jsi_OpCode *)Jsi_Calloc(size, sizeof(jsi_OpCode));
ops->code_size = size;
#ifdef JSI_MEM_DEBUG
static int idNum = 0;
ops->hPtr = Jsi_HashSet(jsiIntData.mainInterp->codesTbl, ops, ops);
ops->id = idNum++;
#endif
return ops;
}
|
CWE-120
| null | 520,143 |
118951729689390030849294500575859123382
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC jsi_InitJSON(Jsi_Interp *interp, int release) {
if (release) return JSI_OK;
Jsi_CommandCreateSpecs(interp, "JSON", jsonCmds, NULL, 0);
#ifdef TEST_JSON_INVOKE
Jsi_Value *ret = Jsi_ValueNew1(interp);
Jsi_CommandInvokeJSON(interp, "Info.cmds", "[\"*\", true]", ret);
Jsi_DString dStr = {};
Jsi_Puts(NULL, Jsi_ValueGetDString(interp, ret, &dStr, 1), -1);
Jsi_DSFree(&dStr);
Jsi_DecrRefCount(interp, ret);
#endif
return JSI_OK;
}
|
CWE-120
| null | 520,144 |
18874523939638534717609630284451574214
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
bool Jsi_ValueIsEqual(Jsi_Interp* interp, Jsi_Value* v1, Jsi_Value* v2)
{
int eq = 0;
if (v1->vt == JSI_VT_OBJECT && v2->vt == JSI_VT_OBJECT && v1->d.obj == v2->d.obj)
eq = 1;
else if (Jsi_ValueIsNull(interp, v1) && Jsi_ValueIsNull(interp, v2))
eq = 1;
else if (Jsi_ValueIsUndef(interp, v1) && Jsi_ValueIsUndef(interp, v2))
eq = 1;
else if (Jsi_ValueIsBoolean(interp, v1) && Jsi_ValueIsBoolean(interp, v2)) {
bool b1, b2;
eq = (Jsi_GetBoolFromValue(interp, v1, &b1) == JSI_OK
&& Jsi_GetBoolFromValue(interp, v2, &b2) == JSI_OK
&& b1 == b2);
} else if (Jsi_ValueIsNumber(interp, v1) && Jsi_ValueIsNumber(interp, v2)) {
Jsi_Number n1, n2;
eq = (Jsi_GetNumberFromValue(interp, v1, &n1) == JSI_OK
&& Jsi_GetNumberFromValue(interp, v2, &n2) == JSI_OK
&& n1 == n2);
} else if (Jsi_ValueIsString(interp, v1) && Jsi_ValueIsString(interp, v2)) {
const char *s1, *s2;
int l1, l2;
eq = (((s1=Jsi_ValueString(interp, v1, &l1)) && ((s2=Jsi_ValueString(interp, v2, &l2)))
&& l1 == l2 && Jsi_Strcmp(s1, s2)==0));
}
return eq;
}
|
CWE-120
| null | 520,145 |
175463433840779295700479083835538181771
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void* Jsi_Calloc(unsigned int n,unsigned int size) {
void *v = calloc(n,size);
Assert(v);
return v;
}
|
CWE-120
| null | 520,146 |
301752677840806720934953285023215023528
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Number Jsi_Version(void) {
Jsi_Number d = JSI_VERSION;
return d;
}
|
CWE-120
| null | 520,147 |
298201600462481268227411341293370644146
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_MapDelete (Jsi_Map *mapPtr) {
SIGASSERTV(mapPtr, MAP);
switch (mapPtr->typ) {
case JSI_MAP_HASH: Jsi_HashDelete(mapPtr->v.hash); break;
case JSI_MAP_TREE: Jsi_TreeDelete(mapPtr->v.tree); break;
case JSI_MAP_LIST: Jsi_ListDelete(mapPtr->v.list); break;
default: return;
}
Jsi_Free(mapPtr);
}
|
CWE-120
| null | 520,148 |
142962896325812150619450216796243521432
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC MySqlEvalCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
MySqlObj *jdb = _mysql_getDbHandle(interp, _this, funcPtr);
if (!jdb) return JSI_ERROR;
int zLen, cnt = 0;
Jsi_RC rc = JSI_OK;
const char *zSql = Jsi_ValueArrayIndexToStr(interp, args, 0, &zLen);
if (mysql_real_query(jdb->db, zSql, zLen))
rc = Jsi_LogError("mysql error: %s", mysql_error(jdb->db));
else if (jdb->enableMulti) {
MYSQL_RES *results;
int sr = mysql_next_result(jdb->db);
while (sr == 0 && (results = mysql_store_result(jdb->db)))
mysql_free_result(results);
cnt = mysql_field_count(jdb->db);
}
if (rc == JSI_OK)
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)cnt);
return rc;
}
|
CWE-120
| null | 520,149 |
167685009671233374348187562992645273435
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC Jsi_GetStringFromValue(Jsi_Interp* interp, Jsi_Value *value, const char **n)
{
if (!value)
return JSI_ERROR;
if (value->vt == JSI_VT_STRING)
{
*n = (const char*)value->d.s.str;
return JSI_OK;
}
if (value->vt == JSI_VT_OBJECT && value->d.obj->ot == JSI_OT_STRING) {
*n = value->d.obj->d.s.str;
return JSI_OK;
}
Jsi_LogError("invalid string");
return JSI_ERROR;
}
|
CWE-120
| null | 520,150 |
31014128976756081639208378090625630903
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void jsi_DumpOptionSpecs(Jsi_Interp *interp, Jsi_Obj *nobj, Jsi_OptionSpec* spec)
{
int i = 0;
while (spec[i].id>=JSI_OPTION_BOOL && spec[i].id < JSI_OPTION_END) {
Jsi_Obj *sobj = Jsi_ObjNewType(interp, JSI_OT_OBJECT);
Jsi_Value *svalue = Jsi_ValueMakeObject(interp, NULL, sobj);
jsi_DumpOptionSpec(interp, sobj, spec+i, 1);
Jsi_ObjArrayAdd(interp, nobj, svalue);
i++;
}
}
|
CWE-120
| null | 520,151 |
214412665632161612247135482677708324385
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static void jsiSqlFuncUnixTime(sqlite3_context *context, int argc, sqlite3_value**argv) {
Jsi_Db *jdb = (Jsi_Db*)sqlite3_user_data(context);
SQLSIGASSERT(jdb,DB);
Jsi_Interp *interp = jdb->interp;
if (argc>3) {
Jsi_LogWarn("sqlite unixtime, expected: str fmt isutc");
return;
}
const char *str = NULL, *fmt = NULL;
bool isUtc = 0;
if (argc>=1)
str = (char *)sqlite3_value_text(argv[0]);
if (argc>=2)
fmt = (char *)sqlite3_value_text(argv[1]);
if (argc>=3)
isUtc = (bool)sqlite3_value_int64(argv[2]);
Jsi_Number d = 0;
Jsi_DatetimeParse(interp, str, fmt, isUtc, &d, 0);
sqlite3_result_double(context, (double)d);
}
|
CWE-120
| null | 520,152 |
262355218784974914806220358436124486016
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_TreeEntry *Jsi_TreeSearchNext(Jsi_TreeSearch *searchPtr)
{
Jsi_TreeEntry *hPtr = NULL;
if (searchPtr->epoch == searchPtr->treePtr->epoch)
hPtr = searchAdd(searchPtr, NULL);
if (!hPtr)
Jsi_TreeSearchDone(searchPtr);
return hPtr;
}
|
CWE-120
| null | 520,153 |
323931506298507624559182103087239382616
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void jsi_ScopeStrsPush(Jsi_Interp *interp, Jsi_ScopeStrs *ss, const char *string, int argType)
{
if (ss->count >= ss->_size) {
int osz = ss->_size, isold = (ss->args!=NULL);
ss->_size += ALLOC_MOD_SIZE;
if (!isold)
ss->args = (jsi_ArgValue*)Jsi_Calloc(ss->_size, sizeof(ss->args[0]));
else {
ss->args = (jsi_ArgValue*)Jsi_Realloc(ss->args, (ss->_size) * sizeof(ss->args[0]));
memset(ss->args+osz, 0, (ss->_size-osz)* sizeof(ss->args[0]));
}
}
ss->args[ss->count].name = (char*)Jsi_KeyAdd(interp, string);
ss->args[ss->count].type = argType;
if (argType)
ss->typeCnt++;
ss->count++;
}
|
CWE-120
| null | 520,154 |
78309330223800932725869860740062207413
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void *Jsi_StackUnshift(Jsi_Stack *stack)
{
if (stack->len == 0)
return NULL;
stack->len--;
void *rc = stack->vector[0];
memmove(stack->vector, stack->vector+1, sizeof(void*)*stack->len);
return rc;
}
|
CWE-120
| null | 520,155 |
75505686932386011819823915892970346273
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Value *Jsi_ValueNew1(Jsi_Interp *interp) { return ValueNew1(interp); }
|
CWE-120
| null | 520,156 |
96444908898944585778464571455906927382
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_OpCodes *code_bnot() { JSI_NEW_CODES(0,OP_BNOT, 0); }
|
CWE-120
| null | 520,157 |
19990689200894119199362595162414851066
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static int jsi_FSSeekProc(Jsi_Channel chan, Jsi_Wide offset, int mode) { return fseek(_JSI_GETFP(chan,1), offset, mode);}
|
CWE-120
| null | 520,158 |
229686876842677245132517835333295302530
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_OpCodes *code_push_index(jsi_Pstate *p, jsi_Pline *line, const char *varname, int local)
{
jsi_FastVar *n = (typeof(n))Jsi_Calloc(1, sizeof(*n));
n->sig = JSI_SIG_FASTVAR;
n->ps = p;
n->context_id = -1;
n->local = local;
n->varname = (char*)Jsi_KeyAdd(p->interp, varname);
Jsi_HashSet(p->fastVarTbl, n, n);
JSI_NEW_CODESLN(1,OP_PUSHVAR, n);
}
|
CWE-120
| null | 520,159 |
162018996893311574115183570707867425707
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
char * Jsi_GetCwd(Jsi_Interp *interp, Jsi_DString *cwdPtr) {
char cdbuf[PATH_MAX];
Jsi_DSInit(cwdPtr);
if (jsiIntData.cwdFsPtr)
Jsi_DSAppend(cwdPtr, Jsi_DSValue(&jsiIntData.pwdStr), NULL);
else
Jsi_DSAppend(cwdPtr, getcwd(cdbuf, sizeof(cdbuf)), NULL);
#ifdef __WIN32
DeBackSlashify(Jsi_DSValue(cwdPtr));
#endif
return Jsi_DSValue(cwdPtr);
}
|
CWE-120
| null | 520,160 |
57909413955507698383650047481314450873
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC jsi_SuboptToValue(Jsi_Interp *interp, Jsi_OptionSpec* spec, Jsi_Value **outValue, Jsi_DString *outStr, void *record, Jsi_Wide flags)
{
if (outStr)
return JSI_ERROR;
char *s = ((char*)record) + spec->offset;
Jsi_OptionSpec *subspec = (Jsi_OptionSpec *)spec->data;
if (spec == subspec)
return Jsi_LogError("recursive subspec not allowed");
if (!subspec)
return Jsi_LogError("custom suboption spec did not set data: %s", spec->name);
return Jsi_OptionsDump(interp, subspec, s, outValue, flags);
}
|
CWE-120
| null | 520,161 |
339451933539041352147676554660452400940
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Wide Jsi_Rewind(Jsi_Interp *interp, Jsi_Channel chan) {
if (chan->fsPtr==0 || !chan->fsPtr->rewindProc) return -1;
return chan->fsPtr->rewindProc(chan);
}
|
CWE-120
| null | 520,162 |
50199716818408527043304534953460992612
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_ValueReplace(Jsi_Interp *interp, Jsi_Value **to, Jsi_Value *from ) {
VALCHK(from);
if( *to == from) return;
if (*to)
Jsi_DecrRefCount(interp, *to);
*to = from;
if (from)
Jsi_IncrRefCount(interp, from);
}
|
CWE-120
| null | 520,163 |
10671922049113548220886092015431977552
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_Value *ValueDup(Jsi_Interp *interp, Jsi_Value *v)
{
Jsi_Value *r = ValueNew1(interp);
Jsi_ValueCopy(interp,r, v);
#ifdef JSI_MEM_DEBUG
r->VD.label2 = "ValueDup";
#endif
return r;
}
|
CWE-120
| null | 520,164 |
136340752041573517377862595838832974598
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_OpCodes *code_fcall(jsi_Pstate *p, jsi_Pline *line, int argc, const char *name, const char *namePre, Jsi_OpCodes *argCodes, Jsi_OpCodes* pref) {
Jsi_OpCodes *codes = code__fcall(p, line, argc, name, namePre, argCodes);
int i;
if (!name || !codes || !pref)
return codes;
jsi_OpLogFlags logflag = jsi_Oplf_none;
if (name[0] == 'a' && !Jsi_Strcmp(name, "assert"))
logflag = jsi_Oplf_assert;
else if (name[0] == 'L' && name[1] == 'o') {
if (!Jsi_Strcmp(name, "LogDebug"))
logflag = jsi_Oplf_debug;
else if (!Jsi_Strcmp(name, "LogTrace"))
logflag = jsi_Oplf_trace;
else if (!Jsi_Strcmp(name, "LogTest"))
logflag = jsi_Oplf_test;
}
if (logflag) {
codes->codes[0].logflag = logflag;
if (argCodes)
for (i=0; i<argCodes->code_len; i++)
argCodes->codes[i].logflag = logflag;
for (i=0; i<pref->code_len; i++)
pref->codes[i].logflag = logflag;
}
return codes;
}
|
CWE-120
| null | 520,165 |
2945557064256139241619818555486727738
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
jsi_ScopeChain *jsi_ScopeChainDupNext(Jsi_Interp *interp, jsi_ScopeChain *sc, Jsi_Value *next)
{
if (!sc) {
jsi_ScopeChain *nr = jsi_ScopeChainNew(interp, 1);
nr->chains[0] = next;
Jsi_IncrRefCount(interp, next);
nr->chains_cnt = 1;
return nr;
}
jsi_ScopeChain *r = jsi_ScopeChainNew(interp, sc->chains_cnt + 1);
int i;
for (i = 0; i < sc->chains_cnt; ++i) {
r->chains[i] = sc->chains[i];
Jsi_IncrRefCount(interp, sc->chains[i]);
}
r->chains[i] = next;
Jsi_IncrRefCount(interp, next);
r->chains_cnt = i + 1;
return r;
}
|
CWE-120
| null | 520,166 |
332844907119587931131491447339282402652
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC dbIsNumArray(Jsi_Interp *interp, Jsi_Value *value, Jsi_OptionSpec* spec, void *record)
{
if (!Jsi_ValueIsArray(interp, value))
return Jsi_LogError("expected array of numbers");
int i, argc = Jsi_ValueGetLength(interp, value);
for (i=0; i<argc; i++) {
Jsi_Value *v = Jsi_ValueArrayIndex(interp, value, i);
if (!Jsi_ValueIsNumber(interp, v))
return Jsi_LogError("expected array of numbers");
}
return JSI_OK;
}
|
CWE-120
| null | 520,167 |
13510523952084388146753631904900279234
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_MapClear (Jsi_Map *mapPtr) {
SIGASSERTV(mapPtr, MAP);
switch (mapPtr->typ) {
case JSI_MAP_HASH: Jsi_HashClear(mapPtr->v.hash); break;
case JSI_MAP_TREE: Jsi_TreeClear(mapPtr->v.tree); break;
case JSI_MAP_LIST: Jsi_ListClear(mapPtr->v.list); break;
default: return;
}
}
|
CWE-120
| null | 520,168 |
128245456689876226039071556091001199060
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static int jsi_FSPutsProc(Jsi_Channel chan, const char *s) {
return fputs(s, _JSI_GETFP(chan,0));
}
|
CWE-120
| null | 520,169 |
3065092113477537726399997427667237546
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
bool Jsi_NumberIsEqual(Jsi_Number n1, Jsi_Number n2)
{
return (n1 == n2); // TODO: Do we need more than this?
}
|
CWE-120
| null | 520,170 |
236451523180875649919285909549554256562
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC SubInterpEvalCallback(Jsi_Interp *interp, void* data)
{
Jsi_RC rc = JSI_OK;
Jsi_DString dStr = {};
if (Jsi_MutexLock(interp, interp->QMutex) != JSI_OK)
return JSI_ERROR;
char *cp = Jsi_DSValue(&interp->interpEvalQ);
if (*cp) {
Jsi_DSAppend(&dStr, cp, NULL);
Jsi_DSSetLength(&interp->interpEvalQ, 0);
interp->threadEvalCnt++;
Jsi_MutexUnlock(interp, interp->QMutex);
if (Jsi_EvalString(interp, Jsi_DSValue(&dStr), 0) != JSI_OK)
rc = JSI_ERROR;
Jsi_DSSetLength(&dStr, 0);
if (Jsi_MutexLock(interp, interp->QMutex) != JSI_OK)
return JSI_ERROR;
}
Jsi_MutexUnlock(interp, interp->QMutex);
Jsi_DSFree(&dStr);
if (Jsi_MutexLock(interp, interp->QMutex) != JSI_OK)
return JSI_ERROR;
/* Process subevents. */
InterpStrEvent *oldse, *se = interp->interpStrEvents;
Jsi_MutexUnlock(interp, interp->QMutex);
while (se) {
oldse = se;
int isExec = se->isExec;
if (se->acdata) {
jsi_AliasCreateCmd(interp, Jsi_DSValue(&se->func), se->acdata);
}
else if (se->acfunc) {
if (JSI_OK != Jsi_FunctionInvokeJSON(interp, se->acfunc, Jsi_DSValue(&se->data), NULL))
rc = JSI_ERROR;
Jsi_DecrRefCount(interp, se->acfunc);
}
else if (isExec) {
if (se->tryDepth)
interp->framePtr->tryDepth++;
se->rc = Jsi_EvalString(interp, Jsi_DSValue(&se->data), 0);
Jsi_DSSetLength(&se->data, 0);
if (se->rc != JSI_OK && se->tryDepth) {
Jsi_DSAppend(&se->data, interp->errMsgBuf, NULL);
se->errLine = interp->errLine;
se->errFile = interp->errFile;
} else {
Jsi_ValueGetDString(interp, interp->retValue, &se->data, JSI_OUTPUT_JSON);
}
if (se->tryDepth)
interp->framePtr->tryDepth--;
/* Otherwise, async calls. */
/*} else if (se->objData) {
if (JSI_OK != Jsi_CommandInvoke(interp, Jsi_DSValue(&se->func), se->objData, NULL))
rc = JSI_ERROR;*/
} else {
const char *scp = Jsi_DSValue(&se->data);
if (JSI_OK != Jsi_CommandInvokeJSON(interp, Jsi_DSValue(&se->func), scp, NULL))
rc = JSI_ERROR;
}
if (!isExec) {
Jsi_DSFree(&se->func);
Jsi_DSFree(&se->data);
}
if (Jsi_MutexLock(interp, interp->QMutex) != JSI_OK)
return JSI_ERROR;
interp->interpStrEvents = se->next;
if (!isExec) Jsi_Free(se);
se = interp->interpStrEvents;
Jsi_MutexUnlock(interp, interp->QMutex);
if (isExec)
oldse->isExec = 0;
}
return rc;
}
|
CWE-120
| null | 520,171 |
313116572640780813692237543567094842518
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC RegExp_constructor(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_Value *target;
if (Jsi_FunctionIsConstructor(funcPtr))
target = _this;
else {
Jsi_Obj *o = Jsi_ObjNewType(interp, JSI_OT_REGEXP);
Jsi_ValueMakeObject(interp, ret, o);
target = *ret;
}
Jsi_Value *v = Jsi_ValueArrayIndex(interp, args, 0);
const char *regtxt = "";
const char *mods = NULL;
if (v) {
if (v->vt == JSI_VT_OBJECT && v->d.obj->ot == JSI_OT_REGEXP) {
Jsi_ValueCopy(interp,target, v);
return JSI_OK;
} else if (!(regtxt = Jsi_ValueString(interp, v, NULL))) {
return JSI_ERROR;
}
}
Jsi_Value *f = Jsi_ValueArrayIndex(interp, args, 1);
if (f)
mods = Jsi_ValueString(interp, f, NULL);
Jsi_DString dStr = {};
Jsi_DSAppend(&dStr, "/", regtxt, "/", mods, NULL);
Jsi_Regex *re = Jsi_RegExpNew(interp, Jsi_DSValue(&dStr), 0);
Jsi_DSFree(&dStr);
if (re == NULL)
return JSI_ERROR;
target->d.obj->d.robj = re;
target->d.obj->ot = JSI_OT_REGEXP;
return JSI_OK;
}
|
CWE-120
| null | 520,172 |
81917596385170345345025313673457395829
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static void MutexDone(Jsi_Mutex *mtx) { DeleteCriticalSection(&mtx->mtx); }
|
CWE-120
| null | 520,173 |
226295738646111806354766676552983738546
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static Jsi_RC WebSocketUnaliasCmd(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 to non-websock object");
int vlen, nlen;
const char *kstr, *vstr, *nstr = Jsi_ValueArrayIndexToStr(interp, args, 0, &nlen);
if (!nstr)
return Jsi_LogError("arg 1: expected string");
Jsi_Value *v, *a = cmdPtr->pathAliases;
if (!a|| !Jsi_ValueIsObjType(interp, a, JSI_OT_OBJECT)) return JSI_OK;
Jsi_IterObj *io = Jsi_IterObjNew(interp, NULL);
Jsi_IterGetKeys(interp, cmdPtr->pathAliases, io, 0);
uint i;
for (i=0; i<io->count; i++) {
kstr = io->keys[i];
v = Jsi_ValueObjLookup(interp, a, kstr, 1);
if (!v) continue;
vstr = Jsi_ValueToString(interp, v, &vlen);
if (!vstr) continue;
if (nlen<=vlen) continue;
if (Jsi_Strncmp(vstr, nstr, vlen)) continue;
Jsi_DString dStr = {};
Jsi_DSAppend(&dStr, "/", kstr, nstr+vlen, NULL);
Jsi_ValueFromDS(interp, &dStr, ret);
break;
}
Jsi_IterObjFree(io);
return JSI_OK;
}
|
CWE-120
| null | 520,174 |
15053045631098098521937147860977321681
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_Map* Jsi_MapNew (Jsi_Interp *interp, Jsi_Map_Type listType, Jsi_Key_Type keyType, Jsi_MapDeleteProc *freeProc)
{
Jsi_Map *lPtr, lval = {.sig=JSI_SIG_MAP};
lval.typ = listType;
switch (listType) {
case JSI_MAP_HASH: lval.v.hash = Jsi_HashNew(interp, keyType, (Jsi_HashDeleteProc*)freeProc); break;
case JSI_MAP_TREE: lval.v.tree = Jsi_TreeNew(interp, keyType, (Jsi_TreeDeleteProc*)freeProc); break;
case JSI_MAP_LIST: lval.v.list = Jsi_ListNew(interp, keyType, (Jsi_HashDeleteProc*)freeProc); break;
default: return NULL;
}
if (!lval.v.hash) return NULL;
lPtr = (Jsi_Map*)Jsi_Malloc(sizeof(*lPtr));
*lPtr = lval;
return lPtr;
}
|
CWE-120
| null | 520,175 |
199313286570373107407291878245847860433
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC Jsi_ValueGetKeys(Jsi_Interp *interp, Jsi_Value *target, Jsi_Value *ret)
{
uint i, n = 0;
Jsi_IterObj *io;
if (target->vt != JSI_VT_OBJECT)
return JSI_ERROR;
Jsi_Obj *to = target->d.obj;
Jsi_Obj *r = Jsi_ObjNewType(interp, JSI_OT_ARRAY);
Jsi_ValueMakeArrayObject(interp, &ret, r);
if (to->arr) {
for (i=0; i<to->arrCnt; i++)
if (to->arr[i]) n++;
if (Jsi_ObjArraySizer(interp, r, n) <= 0) {
Jsi_LogError("too long");
Jsi_ValueMakeUndef(interp, &ret);
return JSI_ERROR;
}
for (i=0, n=0; i<to->arrCnt; i++) {
if (to->arr[i]) {
r->arr[n] = Jsi_ValueNewNumber(interp, (Jsi_Number)i);
Jsi_IncrRefCount(interp, r->arr[n]);
n++;
}
}
r->arrCnt = n;
return JSI_OK;
}
io = Jsi_IterObjNew(interp, NULL);
Jsi_IterGetKeys(interp, target, io, 0);
if (Jsi_ObjArraySizer(interp, r, io->count) <= 0) {
Jsi_LogError("too long");
Jsi_ValueMakeUndef(interp, &ret);
return JSI_ERROR;
}
for (i=0; i<io->count; i++) {
r->arr[i] = (io->keys[i] ? Jsi_ValueNewStringKey(interp, io->keys[i]) : NULL);
Jsi_IncrRefCount(interp, r->arr[i]);
}
io->count = 0;
r->arrCnt = i;
Jsi_IterObjFree(io);
return JSI_OK;
}
|
CWE-120
| null | 520,176 |
278896204854799461793967823198585489310
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
void Jsi_ValueReset(Jsi_Interp *interp, Jsi_Value **vPtr) {
Jsi_Value *v = *vPtr;
SIGASSERTV(v,VALUE);
Assert(v->vt <= JSI_VT__MAX);
jsi_DebugValue(v, "Reset", jsi_DebugValueCallIdx(), interp);
Assert(v->refCnt>=0);
v->f.bits.lookupfailed = 0; // TODO: rework lookup-fail mechanism.
if (v->vt == JSI_VT_UNDEF)
return;
ValueFree(interp, v);
v->f.flag = 0;
}
|
CWE-120
| null | 520,177 |
35543932954706651325478984012545930412
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC Jsi_HashKeysDump(Jsi_Interp *interp, Jsi_Hash *tablePtr, Jsi_Value **ret, int flags) {
char *key;
int n = 0;
Jsi_HashEntry *hPtr;
Jsi_HashSearch search;
Jsi_Obj *nobj;
Jsi_MapFmtKeyProc* fmtKeyProc = (Jsi_MapFmtKeyProc*)tablePtr->opts.fmtKeyProc;
if (!fmtKeyProc && tablePtr->keyType == JSI_KEYS_ONEWORD && flags!=JSI_KEYS_ONEWORD )
fmtKeyProc = jsi_hashFmtKey;
if (!fmtKeyProc && tablePtr->keyType >= JSI_KEYS_STRUCT_MINSIZE)
return Jsi_LogError("Can not dump struct hash");
nobj = Jsi_ObjNew(interp);
Jsi_ValueMakeArrayObject(interp, ret, nobj);
for (hPtr = Jsi_HashSearchFirst(tablePtr, &search);
hPtr != NULL; hPtr = Jsi_HashSearchNext(&search)) {
key = (char*)Jsi_HashKeyGet(hPtr);
Jsi_Value *val;
if (fmtKeyProc) {
val = (*fmtKeyProc)((Jsi_MapEntry*)hPtr, &tablePtr->opts, flags);
if (!val) {
Jsi_LogError("key format failed");
Jsi_ValueMakeUndef(interp, ret);
return JSI_ERROR;
}
} else if (tablePtr->keyType == JSI_KEYS_ONEWORD)
val = Jsi_ValueNewNumber(interp, (Jsi_Number)(uintptr_t)key);
else
val = Jsi_ValueNewStringKey(interp, key);
Jsi_ObjArraySet(interp, nobj, val, n++);
if (fmtKeyProc && val->refCnt>1) //TODO: Hmmm. for StructKey Jsi_OptionsDump() returns refCnt=1
Jsi_DecrRefCount(interp, val);
}
return JSI_OK;
}
|
CWE-120
| null | 520,178 |
48706839285677993322465280614098878805
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC Jsi_GetWideFromValue(Jsi_Interp* interp, Jsi_Value *value, Jsi_Wide *n)
{
if (!value)
return JSI_ERROR;
if (!interp->strict)
jsi_ValueToOInt32(interp, value);
if (!Jsi_ValueIsNumber(interp, value))
return Jsi_LogError("invalid number");
*n = (Jsi_Wide)(value->vt == JSI_VT_NUMBER ? value->d.num : value->d.obj->d.num);
return JSI_OK;
}
|
CWE-120
| null | 520,179 |
71253624667051856939521853985174988555
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static int dbBusyHandler(void *cd, int nTries) {
int rc;
Jsi_Db *jdb = (Jsi_Db*)cd;
Jsi_Value *vpargs, *items[3] = {}, *ret;
Jsi_Interp *interp = jdb->interp;
items[0] = Jsi_ValueNewObj(interp, jdb->fobj);
items[1] = Jsi_ValueMakeNumber(interp, NULL, (Jsi_Number)nTries);
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, items, 2, 0));
Jsi_IncrRefCount(interp, vpargs);
ret = Jsi_ValueNew1(interp);
rc = Jsi_FunctionInvoke(interp, jdb->onBusy, 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;
}
|
CWE-120
| null | 520,180 |
297737914210942188660381475614872125961
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
const char *jsi_typeName(Jsi_Interp *interp, int typ, Jsi_DString *dStr) {
if (typ<=0 || (typ&JSI_TT_ANY)) {
Jsi_DSAppend(dStr, "any", NULL);
return Jsi_DSValue(dStr);
}
int i = 0;
if (typ&JSI_TT_NUMBER) Jsi_DSAppend(dStr, (i++?"|":""), "number", NULL);
if (typ&JSI_TT_STRING) Jsi_DSAppend(dStr, (i++?"|":""), "string", NULL);
if (typ&JSI_TT_BOOLEAN) Jsi_DSAppend(dStr, (i++?"|":""), "boolean", NULL);
if (typ&JSI_TT_ARRAY) Jsi_DSAppend(dStr, (i++?"|":""), "array", NULL);
if (typ&JSI_TT_FUNCTION) Jsi_DSAppend(dStr, (i++?"|":""), "function", NULL);
if (typ&JSI_TT_OBJECT) Jsi_DSAppend(dStr, (i++?"|":""), "object", NULL);
if (typ&JSI_TT_REGEXP) Jsi_DSAppend(dStr, (i++?"|":""), "regexp", NULL);
if (typ&JSI_TT_USEROBJ) Jsi_DSAppend(dStr, (i++?"|":""), "userobj", NULL);
if (typ&JSI_TT_ITEROBJ) Jsi_DSAppend(dStr, (i++?"|":""), "iterobj", NULL);
if (typ&JSI_TT_NULL) Jsi_DSAppend(dStr, (i++?"|":""), "null", NULL);
if (typ&JSI_TT_UNDEFINED) Jsi_DSAppend(dStr, (i++?"|":""), "undefined", NULL);
if (typ&JSI_TT_VOID) Jsi_DSAppend(dStr, (i++?"|":""), "void", NULL);
return Jsi_DSValue(dStr);
}
|
CWE-120
| null | 520,181 |
288105337497309768526270747617620256186
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
bool jsi_ModBlacklisted(Jsi_Interp *interp, const char *mod) {
if (!interp->subOpts.blacklist) return false;
const char *blstr =Jsi_Strstr(interp->subOpts.blacklist, mod);
if (!blstr) return false;
if ((blstr==interp->subOpts.blacklist || !isalnum(blstr[-1])) && !isalnum(blstr[Jsi_Strlen(mod)]))
return false;
return true;
}
|
CWE-120
| null | 520,182 |
110235426255198813518053790455463483784
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
Jsi_RC jsi_InitString(Jsi_Interp *interp, int release)
{
if (!release)
interp->String_prototype = Jsi_CommandCreateSpecs(interp, "String", stringCmds, NULL, JSI_CMDSPEC_ISOBJ);
return JSI_OK;
}
|
CWE-120
| null | 520,183 |
164923333939214175092475367456866326617
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
static void MutexInit(Jsi_Mutex *mtx) { InitializeCriticalSection(&mtx->mtx); }
|
CWE-120
| null | 520,184 |
186591699994648119042576164498248761516
| null | null |
other
|
jsish
|
430ea27accd4d4ffddc946c9402e7c9064835a18
| 0 |
unsigned char *Jsi_ValueBlob(Jsi_Interp *interp, Jsi_Value* v, int *lenPtr)
{
return (unsigned char*)Jsi_ValueString(interp, v, lenPtr);
}
|
CWE-120
| null | 520,185 |
202475223105660169711519399143256344819
| null | null |
other
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.