cve_id
stringlengths 13
16
| obtain_all_privilege
stringclasses 3
values | obtain_user_privilege
stringclasses 2
values | obtain_other_privilege
stringclasses 2
values | user_interaction_required
stringclasses 3
values | cvss2_vector_string
stringclasses 106
values | cvss2_access_vector
stringclasses 4
values | cvss2_access_complexity
stringclasses 4
values | cvss2_authentication
stringclasses 3
values | cvss2_confidentiality_impact
stringclasses 4
values | cvss2_integrity_impact
stringclasses 4
values | cvss2_availability_impact
stringclasses 4
values | cvss2_base_score
stringclasses 50
values | cvss3_vector_string
stringclasses 226
values | cvss3_attack_vector
stringclasses 5
values | cvss3_attack_complexity
stringclasses 3
values | cvss3_privileges_required
stringclasses 4
values | cvss3_user_interaction
stringclasses 3
values | cvss3_scope
stringclasses 3
values | cvss3_confidentiality_impact
stringclasses 4
values | cvss3_integrity_impact
stringclasses 4
values | cvss3_availability_impact
stringclasses 4
values | cvss3_base_score
stringclasses 55
values | cvss3_base_severity
stringclasses 5
values | exploitability_score
stringclasses 22
values | impact_score
stringclasses 15
values | ac_insuf_info
stringclasses 3
values | reference_json
stringlengths 221
23.3k
| problemtype_json
stringclasses 200
values | severity
stringclasses 4
values | cve_nodes
stringlengths 2
33.1k
| cve_description
stringlengths 64
1.99k
| cve_last_modified_date
stringlengths 17
17
| cve_published_date
stringlengths 17
17
| cwe_name
stringclasses 125
values | cwe_description
stringclasses 124
values | cwe_extended_description
stringclasses 95
values | cwe_url
stringclasses 124
values | cwe_is_category
int64 0
1
| commit_author
stringlengths 0
34
| commit_author_date
stringlengths 25
25
| commit_msg
stringlengths 0
13.3k
| commit_hash
stringlengths 40
40
| commit_is_merge
stringclasses 1
value | repo_name
stringclasses 467
values | repo_description
stringclasses 459
values | repo_date_created
stringclasses 467
values | repo_date_last_push
stringclasses 467
values | repo_homepage
stringclasses 294
values | repo_owner
stringclasses 470
values | repo_stars
stringclasses 406
values | repo_forks
stringclasses 352
values | function_name
stringlengths 3
120
| function_signature
stringlengths 6
640
| function_parameters
stringlengths 2
302
| function
stringlengths 12
114k
| function_token_count
stringlengths 1
5
| function_before_change
stringclasses 1
value | labels
int64 1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayConcatCmd | jsi_ArrayConcatCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayConcatCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_RC rc = JSI_OK;
int curlen, argc, nsiz;
Jsi_Obj *obj, *nobj;
Jsi_Value *va;
obj = _this->d.obj;
argc = Jsi_ValueGetLength(interp, args);
curlen = Jsi_ObjGetLength(interp, obj);
if (curlen < 0) {
Jsi_ObjSetLength(interp, obj, 0);
}
Jsi_ObjListifyArray(interp, obj);
nobj = Jsi_ObjNewType(interp, JSI_OT_ARRAY);
nsiz = obj->arrMaxSize;
if (nsiz<=0) nsiz = 100;
if (Jsi_ObjArraySizer(interp, nobj, nsiz+1) <= 0) {
rc = JSI_ERROR;
Jsi_LogError("index too large: %d", nsiz+1);
goto bail;
}
int i, j, m;
for (i = 0; i<curlen; i++)
{
if (!obj->arr[i]) continue;
nobj->arr[i] = NULL;
Jsi_ValueDup2(interp, nobj->arr+i, obj->arr[i]);
}
m = i;
for (i = 0; i < argc; i++) {
va = Jsi_ValueArrayIndex(interp, args, i);
if (va->vt == JSI_VT_OBJECT && Jsi_ObjIsArray(interp, va->d.obj)) {
int margc = Jsi_ValueGetLength(interp, va);
Jsi_Obj *mobj = va->d.obj;
Jsi_ObjListifyArray(interp, mobj);
if (Jsi_ObjArraySizer(interp, nobj, curlen += margc) <= 0) {
rc = JSI_ERROR;
Jsi_LogError("index too large: %d", curlen);
goto bail;
}
for (j = 0; j<margc; j++, m++)
{
if (!mobj->arr[j]) continue;
nobj->arr[m] = NULL;
Jsi_ValueDup2(interp, nobj->arr+m, mobj->arr[j]);
}
} else {
if (Jsi_ObjArraySizer(interp, nobj, ++curlen) <= 0) {
rc = JSI_ERROR;
Jsi_LogError("index too large: %d", curlen);
goto bail;
}
nobj->arr[m] = NULL;
Jsi_ValueDup2(interp, nobj->arr+m++, va);
}
}
Jsi_ObjSetLength(interp, nobj, curlen);
Jsi_ValueMakeArrayObject(interp, ret, nobj);
return JSI_OK;
bail:
Jsi_ValueMakeNull(interp, ret);
return rc;
} | 497 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayFillCmd | jsi_ArrayFillCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayFillCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_RC rc = JSI_OK;
int istart = 0, iend, n, nsiz;
Jsi_Number nstart = 0, nend = 0; // TODO: merge with code in ArraySliceCmd.
Jsi_Value *value = Jsi_ValueArrayIndex(interp, args, 0),
*start = Jsi_ValueArrayIndex(interp, args, 1),
*end = Jsi_ValueArrayIndex(interp, args, 2);
Jsi_Obj *obj = _this->d.obj;
n = Jsi_ObjGetLength(interp, obj);
if (start && Jsi_GetNumberFromValue(interp, start, &nstart) == JSI_OK) {
istart = (int)nstart;
if (istart > n)
goto bail;
if (istart < 0)
istart = (n+istart);
if (istart<0)
goto bail;
}
if (n == 0) {
goto bail;
}
iend = n-1;
if (end && Jsi_GetNumberFromValue(interp,end, &nend) == JSI_OK) {
iend = (int) nend;
if (iend >= n)
iend = n;
if (iend < 0)
iend = (n+iend);
if (iend<0)
goto bail;
}
nsiz = iend-istart+1;
if (nsiz<=0)
goto bail;
int i;
for (i = istart; i <= iend; i++)
{
if (obj->arr[i])
Jsi_ValueCopy(interp, obj->arr[i], value);
else
obj->arr[i] = Jsi_ValueDup(interp, value);
}
bail:
if (_this != *ret) {
Jsi_ValueMove(interp, *ret, _this);
/*if (*ret)
Jsi_DecrRefCount(interp, *ret);
*ret = _this;
Jsi_IncrRefCount(interp, *ret);*/
}
return rc;
} | 360 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayFilterCmd | jsi_ArrayFilterCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayFilterCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_RC rc = JSI_OK;
int curlen, nsiz, i, fval, n = 0, maa = 0;
Jsi_Obj *obj, *nobj;
Jsi_Value *func, *vpargs, *nthis = NULL, *sthis, *nrPtr = NULL;
Jsi_Func *fptr = NULL;
func = Jsi_ValueArrayIndex(interp, args, 0);
if (!Jsi_ValueIsFunction(interp, func))
return Jsi_LogError("expected function");
sthis = Jsi_ValueArrayIndex(interp, args, 1);
if (!sthis)
sthis = nthis = Jsi_ValueNew1(interp);
obj = _this->d.obj;
curlen = Jsi_ObjGetLength(interp, obj);
if (curlen < 0) {
Jsi_ObjSetLength(interp, obj, 0);
}
Jsi_ObjListifyArray(interp, obj);
nobj = Jsi_ObjNewType(interp, JSI_OT_ARRAY);
nsiz = obj->arrCnt;
if (nsiz<=0) nsiz = 1;
if (Jsi_ObjArraySizer(interp, nobj, nsiz) <= 0) {
Jsi_LogError("index too large: %d", nsiz);
rc = JSI_ERROR;
goto bail;
}
Jsi_ValueMakeArrayObject(interp, ret, nobj);
nrPtr = Jsi_ValueNew1(interp);
Jsi_Value *vobjs[4];
fptr = func->d.obj->d.fobj->func;
maa = (fptr->argnames?fptr->argnames->argCnt:0);
if (maa>3)
maa = 3;
for (i = 0; i < curlen; i++) {
if (!obj->arr[i]) continue;
vobjs[0] = obj->arr[i];
vobjs[1] = (maa>1?Jsi_ValueNewNumber(interp, i):NULL);
vobjs[2] = _this;
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, vobjs, maa, 0));
Jsi_IncrRefCount(interp, vpargs);
rc = Jsi_FunctionInvoke(interp, func, vpargs, &nrPtr, sthis);
Jsi_DecrRefCount(interp, vpargs);
fval = Jsi_ValueIsTrue(interp, nrPtr);
Jsi_ValueMakeUndef(interp, &nrPtr);
if( JSI_OK!=rc ) {
goto bail;
}
if (fval) {
nobj->arr[n++] = obj->arr[i];
Jsi_IncrRefCount(interp, obj->arr[i]);
}
}
if (nthis)
Jsi_DecrRefCount(interp, nthis);
Jsi_DecrRefCount(interp, nrPtr);
Jsi_ObjSetLength(interp, nobj, n);
return JSI_OK;
bail:
if (nthis)
Jsi_DecrRefCount(interp, nthis);
if (nrPtr)
Jsi_DecrRefCount(interp, nrPtr);
Jsi_ValueMakeNull(interp, ret);
return rc;
} | 556 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayFindSubCmd | jsi_ArrayFindSubCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr , int op) | ['interp', 'args', '_this', 'ret', 'funcPtr', 'op'] | static Jsi_RC jsi_ArrayFindSubCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr, int op) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array");
Jsi_Obj *obj;
int curlen;
uint i;
Jsi_RC rc = JSI_OK;
Jsi_Value *func, *vpargs, *sthis = Jsi_ValueArrayIndex(interp, args, 1);
func = Jsi_ValueArrayIndex(interp, args, 0);
if (!Jsi_ValueIsFunction(interp, func))
return Jsi_LogError("expected function");
Jsi_Value *nthis = NULL;
if (!sthis)
sthis = nthis = Jsi_ValueNew1(interp);
obj = _this->d.obj;
curlen = Jsi_ObjGetLength(interp, obj);
if (curlen < 0) {
Jsi_ObjSetLength(interp, obj, 0);
}
Jsi_ObjListifyArray(interp, obj);
int fval = 0;
Jsi_Value *nrPtr = Jsi_ValueNew1(interp);
Jsi_Value *vobjs[3];
Jsi_Func *fptr = func->d.obj->d.fobj->func;
int maa = (fptr->argnames?fptr->argnames->argCnt:0);
if (maa>3)
maa = 3;
for (i = 0; i < obj->arrCnt && rc == JSI_OK; i++) {
if (!obj->arr[i]) continue;
vobjs[0] = obj->arr[i];
vobjs[1] = (maa>1?Jsi_ValueNewNumber(interp, i):NULL);
vobjs[2] = _this;
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, vobjs, maa, 0));
Jsi_IncrRefCount(interp, vpargs);
rc = Jsi_FunctionInvoke(interp, func, vpargs, &nrPtr, sthis);
Jsi_DecrRefCount(interp, vpargs);
if (rc != JSI_OK)
break;
fval = Jsi_ValueIsTrue(interp, nrPtr);
Jsi_ValueMakeUndef(interp, &nrPtr);
if (op == 3) {
if (!fval) break;
} else if (fval)
break;
}
if (rc == JSI_OK) {
if (op == 1 && fval) // Find
Jsi_ValueCopy(interp, *ret, obj->arr[i]);
else if (op == 2 || op == 3) // Some/Every
Jsi_ValueMakeBool(interp, ret, fval);
else if (op == 4)
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)(fval?(int)i:-1));
}
if (nthis)
Jsi_DecrRefCount(interp, nthis);
Jsi_DecrRefCount(interp, nrPtr);
return rc;
} | 509 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayFlatSub | jsi_ArrayFlatSub( Jsi_Interp * interp , Jsi_Obj * nobj , Jsi_Value * arr , int depth) | ['interp', 'nobj', 'arr', 'depth'] | static Jsi_RC jsi_ArrayFlatSub(Jsi_Interp *interp, Jsi_Obj* nobj, Jsi_Value *arr, int depth) {
int i, n = 0, len = Jsi_ObjGetLength(interp, arr->d.obj);
if (len <= 0) return JSI_OK;
Jsi_RC rc = JSI_OK;
int clen = Jsi_ObjGetLength(interp, nobj);
for (i = 0; i < len && rc == JSI_OK; i++) {
Jsi_Value *t = Jsi_ValueArrayIndex(interp, arr, i);
if (t && depth>0 && Jsi_ValueIsArray(interp, t))
rc = jsi_ArrayFlatSub(interp, nobj, t , depth-1);
else if (!Jsi_ValueIsUndef(interp, t))
Jsi_ObjArrayAdd(interp, nobj, t);
if ((++n + clen)>interp->maxArrayList)
return Jsi_LogError("array size exceeded");
}
return rc;
} | 167 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayForeachCmd | jsi_ArrayForeachCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayForeachCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr)
{
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_Obj *obj;
int curlen;
uint i;
Jsi_Value *func, *vpargs;
func = Jsi_ValueArrayIndex(interp, args, 0);
if (!Jsi_ValueIsFunction(interp, func))
return Jsi_LogError("expected function");
Jsi_Value *sthis = Jsi_ValueArrayIndex(interp, args, 1);
Jsi_Value *nthis = NULL;
if (!sthis)
sthis = nthis = Jsi_ValueNew1(interp);
obj = _this->d.obj;
curlen = Jsi_ObjGetLength(interp, obj);
if (curlen < 0) {
Jsi_ObjSetLength(interp, obj, 0);
}
Jsi_ObjListifyArray(interp, obj);
Jsi_RC rc = JSI_OK;
Jsi_Value *vobjs[3];
Jsi_Func *fptr = func->d.obj->d.fobj->func;
int maa = (fptr->argnames?fptr->argnames->argCnt:0);
if (maa>3)
maa = 3;
for (i = 0; i < obj->arrCnt && rc == JSI_OK; i++) {
if (!obj->arr[i]) continue;
vobjs[0] = obj->arr[i];
vobjs[1] = (maa>1?Jsi_ValueNewNumber(interp, i):NULL);
vobjs[2] = _this;
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, vobjs, maa, 0));
Jsi_IncrRefCount(interp, vpargs);
rc = Jsi_FunctionInvoke(interp, func, vpargs, ret, sthis);
Jsi_DecrRefCount(interp, vpargs);
}
if (nthis)
Jsi_DecrRefCount(interp, nthis);
return rc;
} | 358 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayIndexSubCmd | jsi_ArrayIndexSubCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr , int op) | ['interp', 'args', '_this', 'ret', 'funcPtr', 'op'] | static Jsi_RC jsi_ArrayIndexSubCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr, int op) {
int istart = 0, n, i = 0, dir=1, idx=-1;
Jsi_Value *seq = Jsi_ValueArrayIndex(interp, args, 0),
*start = Jsi_ValueArrayIndex(interp, args, 1);
Jsi_Obj *obj = _this->d.obj;
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
if (!seq) {
goto bail;
}
n = Jsi_ObjGetLength(interp, obj);
if (n == 0) {
goto bail;
}
Jsi_Number nstart;
if (op == 2) {
istart = n-1;
}
if (start && Jsi_GetNumberFromValue(interp,start, &nstart)==JSI_OK) {
istart = (int)nstart;
if (istart > n)
goto bail;
if (istart < 0)
istart = (n+istart);
if (istart<0)
goto bail;
}
if (op == 2) {
istart = n-1;
dir = -1;
}
Jsi_ObjListifyArray(interp, obj);
for (i = istart; ; i+=dir)
{
if ((dir>0 && i>=n) || (dir<0 && i<0) || i>=(int)obj->arrCnt)
break;
if (obj->arr[i] && Jsi_ValueCmp(interp, obj->arr[i], seq, JSI_CMP_EXACT)==0) {
idx = i;
break;
}
}
bail:
if (op == 3)
Jsi_ValueMakeBool(interp, ret, (idx!=-1));
else
Jsi_ValueMakeNumber(interp, ret, idx);
return JSI_OK;
} | 354 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayJoinCmd | jsi_ArrayJoinCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayJoinCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
const char *jstr = "";
int argc, curlen;
Jsi_DString dStr = {};
curlen = Jsi_ObjGetLength(interp, _this->d.obj);
if (curlen == 0) {
goto bail;
}
if (Jsi_ValueGetLength(interp, args) >= 1) {
Jsi_Value *sc = Jsi_ValueArrayIndex(interp, args, 0);
if (sc != NULL)
jstr = Jsi_ValueToString(interp, sc, NULL);
}
if (0 == (argc=Jsi_ObjGetLength(interp, _this->d.obj))) {
goto bail;
}
int i;
for (i = 0; i < argc; ++i) {
const char *cp;
Jsi_Value *ov = Jsi_ValueArrayIndex(interp, _this, i);
if (!ov) {
/* TODO: are NULL args ok? */
continue;
cp = "";
} else
cp = Jsi_ValueToString(interp, ov, NULL);
if (i && jstr[0])
Jsi_DSAppend(&dStr, jstr, NULL);
Jsi_DSAppend(&dStr, cp, NULL);
}
Jsi_ValueMakeStringDup(interp, ret, Jsi_DSValue(&dStr));
Jsi_DSFree(&dStr);
return JSI_OK;
bail:
Jsi_ValueMakeStringDup(interp, ret, "");
return JSI_OK;
} | 285 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayMapCmd | jsi_ArrayMapCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayMapCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_RC rc = JSI_OK;
int curlen, nsiz, i, maa = 0;
Jsi_Obj *obj, *nobj;
Jsi_Value *func, *vpargs, *nthis = NULL, *sthis;
Jsi_Func *fptr = NULL;
func = Jsi_ValueArrayIndex(interp, args, 0);
if (!Jsi_ValueIsFunction(interp, func))
return Jsi_LogError("expected function");
sthis = Jsi_ValueArrayIndex(interp, args, 1);
if (!sthis)
sthis = nthis = Jsi_ValueNew1(interp);
obj = _this->d.obj;
curlen = Jsi_ObjGetLength(interp, obj);
if (curlen < 0) {
Jsi_ObjSetLength(interp, obj, 0);
}
Jsi_ObjListifyArray(interp, obj);
nobj = Jsi_ObjNewType(interp, JSI_OT_ARRAY);
nsiz = obj->arrCnt;
if (nsiz<=0) nsiz = 1;
if (Jsi_ObjArraySizer(interp, nobj, nsiz) <= 0) {
Jsi_LogError("index too large: %d", nsiz);
rc = JSI_ERROR;
goto bail;
}
Jsi_ValueMakeArrayObject(interp, ret, nobj);
Jsi_Value *vobjs[3];
fptr = func->d.obj->d.fobj->func;
maa = (fptr->argnames?fptr->argnames->argCnt:0);
if (maa>3)
maa = 3;
for (i = 0; i < curlen; i++) {
if (!obj->arr[i]) continue;
vobjs[0] = obj->arr[i];
vobjs[1] = (maa>1?Jsi_ValueNewNumber(interp, i):NULL);
vobjs[2] = _this;
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, vobjs, maa, 0));
Jsi_IncrRefCount(interp, vpargs);
nobj->arr[i] = Jsi_ValueNew1(interp);
rc = Jsi_FunctionInvoke(interp, func, vpargs, nobj->arr+i, sthis);
Jsi_DecrRefCount(interp, vpargs);
if( JSI_OK!=rc ) {
goto bail;
}
}
Jsi_ObjSetLength(interp, nobj, curlen);
if (nthis)
Jsi_DecrRefCount(interp, nthis);
return JSI_OK;
bail:
Jsi_ValueMakeNull(interp, ret);
if (nthis)
Jsi_DecrRefCount(interp, nthis);
return rc;
} | 485 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayPopCmd | jsi_ArrayPopCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayPopCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj)) {
Jsi_ValueMakeNumber(interp, ret, 0);
return JSI_OK;
}
Jsi_Value *v;
Jsi_Obj *obj;
obj = _this->d.obj;
int i = Jsi_ObjGetLength(interp, obj) - 1;
if (i < 0) {
Jsi_ValueMakeUndef(interp, ret);
return JSI_OK;
}
if (obj->arr) {
if ((v = obj->arr[i])) {
obj->arr[i] = NULL;
obj->arrCnt--;
}
} else {
v = Jsi_ValueArrayIndex(interp, _this, i);
}
if (v) {
Jsi_DecrRefCount(interp, *ret);
*ret = v;
}
Jsi_ObjSetLength(interp, obj, i);
return JSI_OK;
} | 186 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayPushCmd | jsi_ArrayPushCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayPushCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_Obj *obj;
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj)) {
Jsi_ValueMakeNumber(interp, ret, 0);
return JSI_OK;
}
obj = _this->d.obj;
int argc = Jsi_ValueGetLength(interp, args);
int curlen = Jsi_ObjGetLength(interp, obj);
if (curlen < 0) {
Jsi_ObjSetLength(interp, obj, 0);
}
int i;
for (i = 0; i < argc; ++i) {
Jsi_Value *ov = Jsi_ValueArrayIndex(interp, args, i);
if (!ov) { Jsi_LogBug("Arguments Error"); ov = Jsi_ValueNew(interp); }
Jsi_ValueInsertArray(interp, _this, curlen + i, ov, 0);
}
Jsi_ValueMakeNumber(interp, ret, Jsi_ObjGetLength(interp, obj));
return JSI_OK;
} | 189 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayReduceSubCmd | jsi_ArrayReduceSubCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr , int op) | ['interp', 'args', '_this', 'ret', 'funcPtr', 'op'] | static Jsi_RC jsi_ArrayReduceSubCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr, int op) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array");
Jsi_RC rc = JSI_OK;
int curlen, i;
Jsi_Obj *obj;
Jsi_Value *func, *vpargs, *ini = Jsi_ValueArrayIndex(interp, args, 1);
func = Jsi_ValueArrayIndex(interp, args, 0);
if (!Jsi_ValueIsFunction(interp, func))
return Jsi_LogError("expected function");
Jsi_Value *nrPtr = Jsi_ValueNew1(interp);
obj = _this->d.obj;
curlen = Jsi_ObjGetLength(interp, obj);
if (curlen < 0)
Jsi_ObjSetLength(interp, obj, 0);
Jsi_ObjListifyArray(interp, obj);
Jsi_Value *vobjs[4];
int n, rev = (op==2);
Jsi_Func *fptr = func->d.obj->d.fobj->func;
int maa = (fptr->argnames?fptr->argnames->argCnt:0);
if (maa>4)
maa = 4;
for (n = 0, i = (rev?obj->arrCnt-1:0); (rev?i>=0:i < (int)obj->arrCnt) && rc == JSI_OK; n++, i = (rev?i-1:i+1)) {
if (!obj->arr[i]) continue;
if (n==0 && !ini) {
ini = obj->arr[i];
continue;
}
vobjs[0] = ini;
vobjs[1] = obj->arr[i];
vobjs[2] = (maa>2?Jsi_ValueNewNumber(interp, i):NULL);
vobjs[3] = _this;
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, vobjs, maa, 0));
Jsi_IncrRefCount(interp, vpargs);
rc = Jsi_FunctionInvoke(interp, func, vpargs, &nrPtr, NULL);
Jsi_DecrRefCount(interp, vpargs);
if (rc != JSI_OK)
break;
ini = nrPtr;
}
if (rc == JSI_OK && ini)
Jsi_ValueCopy(interp, *ret, ini);
Jsi_DecrRefCount(interp, nrPtr);
return rc;
} | 452 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayShiftCmd | jsi_ArrayShiftCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayShiftCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_Value *v;
Jsi_Obj *obj = _this->d.obj;
Jsi_ObjListifyArray(interp, obj);
uint n = Jsi_ObjGetLength(interp, obj);
assert(n <= obj->arrCnt);
if (n<=0) {
Jsi_ValueMakeUndef(interp, ret);
} else {
n--;
v = obj->arr[0];
memmove(obj->arr, obj->arr+1, n*sizeof(Jsi_Value*));
obj->arr[n] = NULL;
Jsi_ValueDup2(interp, ret, v);
Jsi_DecrRefCount(interp, v);
Jsi_ObjSetLength(interp, obj, n);
}
return JSI_OK;
} | 178 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArraySizeOfCmd | jsi_ArraySizeOfCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArraySizeOfCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
int i = Jsi_ObjGetLength(interp, _this->d.obj);
Jsi_ValueMakeNumber(interp, ret, i);
return JSI_OK;
} | 76 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArraySliceCmd | jsi_ArraySliceCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArraySliceCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_RC rc = JSI_OK;
int istart = 0, iend, n, nsiz;
Jsi_Number nstart;
Jsi_Obj *nobj, *obj;
Jsi_Value *start = Jsi_ValueArrayIndex(interp, args, 0),
*end = Jsi_ValueArrayIndex(interp, args, 1);
if (!start) {
goto bail;
}
obj = _this->d.obj;
n = Jsi_ObjGetLength(interp, obj);
if (Jsi_GetNumberFromValue(interp,start, &nstart) == JSI_OK) {
istart = (int)nstart;
if (istart > n)
goto done;
if (istart < 0)
istart = (n+istart);
if (istart<0)
goto bail;
}
if (n == 0) {
done:
Jsi_ValueMakeArrayObject(interp, ret, Jsi_ObjNewType(interp, JSI_OT_ARRAY));
return JSI_OK;
}
Jsi_Number nend;
iend = n-1;
if (end && Jsi_GetNumberFromValue(interp,end, &nend) == JSI_OK) {
iend = (int) nend;
if (iend >= n)
iend = n;
if (iend < 0)
iend = (n+iend);
if (iend<0)
goto bail;
}
nsiz = iend-istart+1;
if (nsiz<=0)
goto done;
Jsi_ObjListifyArray(interp, obj);
nobj = Jsi_ObjNewType(interp, JSI_OT_ARRAY);
if (Jsi_ObjArraySizer(interp, nobj, nsiz) <= 0) {
rc = Jsi_LogError("index too large: %d", nsiz);
goto bail;
}
int i, m;
for (m = 0, i = istart; i <= iend; i++, m++)
{
if (!obj->arr[i]) continue;
nobj->arr[m] = NULL;
Jsi_ValueDup2(interp, nobj->arr+m, obj->arr[i]);
}
Jsi_ObjSetLength(interp, nobj, nsiz);
Jsi_ValueMakeArrayObject(interp, ret, nobj);
return JSI_OK;
bail:
Jsi_ValueMakeNull(interp, ret);
return rc;
} | 436 | True | 1 |
CVE-2020-22875 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'name': 'https://github.com/pcmacdon/jsish/commit/5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/10', 'name': 'https://github.com/pcmacdon/jsish/issues/10', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjSetLength in jsish before 3.0.6, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T18:49Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 16:07:27+00:00 | Release "3.0.6": Fix crashes in Array for "integer overflow #10"
FossilOrigin-Name: 50642d64b8f0a4e62df68e59fcb2ef0923c3dbec8fc8a15d38b1ddbe655c38d6 | 5408a6d93f45bf1f7acd9ae5d44e0ebd77379e98 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayUnshiftCmd | jsi_ArrayUnshiftCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC jsi_ArrayUnshiftCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,Jsi_Value **ret, Jsi_Func *funcPtr) {
if (_this->vt != JSI_VT_OBJECT || !Jsi_ObjIsArray(interp, _this->d.obj))
return Jsi_LogError("expected array object");
Jsi_Obj *obj = _this->d.obj;
int argc = Jsi_ValueGetLength(interp, args);
int curlen = Jsi_ObjGetLength(interp, obj);
if (curlen < 0) {
Jsi_ObjSetLength(interp, obj, 0);
}
if (argc <= 0) {
Jsi_ValueMakeNumber(interp, ret, 0);
return JSI_OK;
}
Jsi_ObjListifyArray(interp, obj);
if (Jsi_ObjArraySizer(interp, obj, curlen+argc)<=0)
return Jsi_LogError("too long");
memmove(obj->arr+argc, obj->arr, (curlen)*sizeof(Jsi_Value*));
obj->arrCnt += argc;
int i;
for (i = 0; i < argc; ++i) {
Jsi_Value *ov = Jsi_ValueArrayIndex(interp, args, i);
obj->arr[i] = NULL;
if (!ov) { Jsi_LogBug("Arguments Error"); continue; }
obj->arr[i] = ov;
Jsi_IncrRefCount(interp, ov);
}
Jsi_ObjSetLength(interp, obj, curlen+argc);
Jsi_ValueMakeNumber(interp, ret, Jsi_ObjGetLength(interp, obj));
return JSI_OK;
} | 272 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | DebugAddCmd | DebugAddCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | 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[100];
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;
} | 418 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | DebugInfoCmd | DebugInfoCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC DebugInfoCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
if (!interp->breakpointHash) {
Jsi_ValueMakeArrayObject(interp, ret, NULL);
return JSI_OK;
}
int argc = Jsi_ValueGetLength(interp, args);
if (argc == 0)
return Jsi_HashKeysDump(interp, interp->breakpointHash, ret, 0);
Jsi_Value *val = Jsi_ValueArrayIndex(interp, args, 0);
int num;
char nbuf[100];
if (Jsi_GetIntFromValue(interp, val, &num) != JSI_OK)
return Jsi_LogError("bad number");
snprintf(nbuf, sizeof(nbuf), "%d", num);
Jsi_HashEntry *hPtr = Jsi_HashEntryFind(interp->breakpointHash, nbuf);
if (!hPtr)
return Jsi_LogError("unknown breakpoint");
jsi_BreakPoint* bp = (jsi_BreakPoint*)Jsi_HashValueGet(hPtr);
if (!bp) return JSI_ERROR;
Jsi_DString dStr = {};
if (bp->func)
Jsi_DSPrintf(&dStr, "{id:%d, type:\"func\", func:\"%s\", hits:%d, enabled:%s, temporary:%s}",
bp->id, bp->func, bp->hits, bp->enabled?"true":"false", bp->temp?"true":"false");
else
Jsi_DSPrintf(&dStr, "{id:%d, type:\"line\", file:\"%s\", line:%d, hits:%d, enabled:%s}",
bp->id, bp->file?bp->file:"", bp->line, bp->hits, bp->enabled?"true":"false");
Jsi_RC rc = Jsi_JSONParse(interp, Jsi_DSValue(&dStr), ret, 0);
Jsi_DSFree(&dStr);
return rc;
} | 290 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | DebugRemoveCmd_ | DebugRemoveCmd_( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr , int op) | ['interp', 'args', '_this', 'ret', 'funcPtr', 'op'] | static Jsi_RC DebugRemoveCmd_(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr, int op)
{
Jsi_Value *val = Jsi_ValueArrayIndex(interp, args, 0);
if (interp->breakpointHash)
{
int num;
char nbuf[100];
if (Jsi_GetIntFromValue(interp, val, &num) != JSI_OK)
return Jsi_LogError("bad number");
snprintf(nbuf, sizeof(nbuf), "%d", num);
Jsi_HashEntry *hPtr = Jsi_HashEntryFind(interp->breakpointHash, nbuf);
jsi_BreakPoint* bptr;
if (hPtr && (bptr = (jsi_BreakPoint*)Jsi_HashValueGet(hPtr))) {
switch (op) {
case 1: bptr->enabled = 0; break;
case 2: bptr->enabled = 1; break;
default:
Jsi_HashEntryDelete(hPtr);
}
return JSI_OK;
}
}
return Jsi_LogError("unknown breakpoint");
} | 171 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | SysGetEnvCmd | SysGetEnvCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC SysGetEnvCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
extern char **environ;
char *cp;
int i;
if (interp->isSafe)
return Jsi_LogError("no getenv in safe mode");
Jsi_Value *v = Jsi_ValueArrayIndex(interp, args, 0);
if (v != NULL) {
const char *fnam = Jsi_ValueString(interp, v, NULL);
if (!fnam)
return Jsi_LogError("arg1: expected string 'name'");
cp = getenv(fnam);
if (cp != NULL) {
Jsi_ValueMakeStringDup(interp, ret, cp);
}
return JSI_OK;
}
/* Single object containing result members. */
Jsi_Value *vres;
Jsi_Obj *ores = Jsi_ObjNew(interp);
Jsi_Value *nnv;
char *val, nam[200];
//Jsi_ObjIncrRefCount(interp, ores);
vres = Jsi_ValueMakeObject(interp, NULL, ores);
//Jsi_IncrRefCount(interp, vres);
for (i=0; ; i++) {
int n;
cp = environ[i];
if (cp == 0 || ((val = Jsi_Strchr(cp, '='))==NULL))
break;
n = val-cp+1;
if (n>=(int)sizeof(nam))
n = sizeof(nam)-1;
Jsi_Strncpy(nam, cp, n);
val = val+1;
nnv = Jsi_ValueMakeStringDup(interp, NULL, val);
Jsi_ObjInsert(interp, ores, nam, nnv, 0);
}
Jsi_ValueReplace(interp, ret, vres);
return JSI_OK;
} | 283 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | SysTimesCmd | SysTimesCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | 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[100];
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;
} | 336 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | SysVerConvertCmd | SysVerConvertCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC SysVerConvertCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_Value *val = Jsi_ValueArrayIndex(interp, args, 0);
Jsi_Value *flag = Jsi_ValueArrayIndex(interp, args, 1);
if (!val) goto bail;
if (Jsi_ValueIsNumber(interp, val)) {
char buf[200];
Jsi_Number n;
if (Jsi_GetNumberFromValue(interp, val, &n) != JSI_OK)
goto bail;
jsi_VersionNormalize(n, buf, sizeof(buf));
int trunc = 0;
if (flag && (Jsi_GetIntFromValue(interp, flag, &trunc) != JSI_OK
|| trunc<0 || trunc>2))
return Jsi_LogError("arg2: bad trunc: expected int between 0 and 2");
if (trunc) {
int len = Jsi_Strlen(buf)-1;
while (trunc>0 && len>1) {
if (buf[len] == '0' && buf[len-1] == '.')
buf[len-1] = 0;
len -= 2;
trunc--;
}
}
Jsi_ValueMakeStringDup(interp, ret, buf);
return JSI_OK;
}
if (Jsi_ValueIsString(interp, val)) {
Jsi_Number n;
if (jsi_GetVerFromVal(interp, val, &n, 0) == JSI_OK) {
Jsi_ValueMakeNumber(interp, ret, n);
return JSI_OK;
}
}
bail:
Jsi_ValueMakeNull(interp, ret);
return JSI_OK;
} | 274 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_PkgDumpInfo | jsi_PkgDumpInfo( Jsi_Interp * interp , const char * name , Jsi_Value ** ret) | ['interp', 'name', 'ret'] | Jsi_RC jsi_PkgDumpInfo(Jsi_Interp *interp, const char *name, Jsi_Value **ret) {
jsi_PkgInfo *ptr;
Jsi_HashEntry *hPtr = Jsi_HashEntryFind(interp->packageHash, name);
if (hPtr && ((ptr = (jsi_PkgInfo*)Jsi_HashValueGet(hPtr)))) {
Jsi_Obj *nobj = Jsi_ObjNew(interp);
Jsi_ValueMakeObject(interp, ret, nobj);
Jsi_ObjInsert(interp, nobj, "name", Jsi_ValueNewStringDup(interp, name), 0);
Jsi_ObjInsert(interp, nobj, "version", Jsi_ValueNewNumber(interp, ptr->version), 0);
Jsi_ObjInsert(interp, nobj, "lastReq", Jsi_ValueNewNumber(interp, ptr->lastReq), 0);
char buf[200];
jsi_VersionNormalize(ptr->version, buf, sizeof(buf));
Jsi_ObjInsert(interp, nobj, "verStr", Jsi_ValueNewStringDup(interp, buf), 0);
const char *cp = (ptr->loadFile?ptr->loadFile:"");
Jsi_ObjInsert(interp, nobj, "loadFile", Jsi_ValueNewStringDup(interp, cp), 0);
Jsi_Value *fval2, *fval = Jsi_NameLookup(interp, name);
if (!fval || !Jsi_ValueIsFunction(interp, fval))
fval = Jsi_ValueNewNull(interp);
Jsi_ObjInsert(interp, nobj, "func", fval, 0);
fval = ptr->popts.info;
if (!fval) fval = interp->NullValue;
if (!Jsi_ValueIsObjType(interp, fval, JSI_OT_FUNCTION))
Jsi_ObjInsert(interp, nobj, "info", fval, 0);
else {
fval2 = Jsi_ValueNew1(interp);
Jsi_RC rc = Jsi_FunctionInvoke(interp, fval, NULL, &fval2, NULL);
if (rc != JSI_OK)
Jsi_LogWarn("status call failed");
Jsi_ObjInsert(interp, nobj, "info", fval2, 0);
Jsi_DecrRefCount(interp, fval2);
}
fval = interp->NullValue;
if (ptr->popts.spec && ptr->popts.data) {
fval = Jsi_ValueNew1(interp);
Jsi_OptionsConf(interp, ptr->popts.spec, ptr->popts.data, NULL, &fval, 0);
}
Jsi_ObjInsert(interp, nobj, "status", fval, 0);
if (fval != interp->NullValue)
Jsi_DecrRefCount(interp, fval);
fval = Jsi_ValueNew1(interp);
Jsi_OptionsConf(interp, jsiModuleOptions, &ptr->popts.modConf, NULL, &fval, 0);
Jsi_ObjInsert(interp, nobj, "moduleOpts", fval, 0);
Jsi_DecrRefCount(interp, fval);
return JSI_OK;
}
return JSI_ERROR;
} | 488 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_code_decode | jsi_code_decode( Jsi_Interp * interp , jsi_OpCode * op , int currentip , char * buf , int bsiz) | ['interp', 'op', 'currentip', 'buf', 'bsiz'] | void jsi_code_decode(Jsi_Interp *interp, jsi_OpCode *op, int currentip, char *buf, int bsiz)
{
if (_JSICASTINT(op->op) < 0 || op->op >= OP_LASTOP) {
snprintf(buf, bsiz, "Bad opcode[%d] at %d", op->op, currentip);
}
char nbuf[100];
snprintf(nbuf, sizeof(nbuf), "%d#%d", currentip, op->Line);
snprintf(buf, bsiz, "%-8s %s ", nbuf, jsi_op_names[op->op]);
int sl = Jsi_Strlen(buf);
char *bp = buf + sl;
bsiz -= sl;
if (op->op == OP_PUSHBOO || op->op == OP_FCALL || op->op == OP_EVAL ||
op->op == OP_POP || op->op == OP_ASSIGN ||
op->op == OP_RET || op->op == OP_NEWFCALL ||
op->op == OP_DELETE || op->op == OP_CHTHIS ||
op->op == OP_OBJECT || op->op == OP_ARRAY ||
op->op == OP_SHF ||
op->op == OP_INC || op->op == OP_DEC) snprintf(bp, bsiz, "%" PRId64, (Jsi_Wide)(uintptr_t)op->data);
else if (op->op == OP_PUSHNUM) Jsi_NumberDtoA(interp, *((Jsi_Number *)op->data), bp, bsiz, 0);
else if (op->op == OP_PUSHVSTR) {
Jsi_String *ss = (Jsi_String*)op->data;
snprintf(bp, bsiz, "\"%s\"", ss->str);
} else if (op->op == OP_PUSHSTR || op->op == OP_LOCAL ||
op->op == OP_SCATCH) snprintf(bp, bsiz, "\"%s\"", op->data ? (char*)op->data:"(NoCatch)");
else if (op->op == OP_PUSHVAR) snprintf(bp, bsiz, "var: \"%s\"", ((jsi_FastVar *)op->data)->varname);
else if (op->op == OP_PUSHFUN) snprintf(bp, bsiz, "func: 0x%" PRIx64, (Jsi_Wide)(uintptr_t)op->data);
else if (op->op == OP_JTRUE || op->op == OP_JFALSE ||
op->op == OP_JTRUE_NP || op->op == OP_JFALSE_NP ||
op->op == OP_JMP) snprintf(bp, bsiz, "{%" PRIu64 "}\t#%" PRIu64 "", (Jsi_Wide)(uintptr_t)op->data, (Jsi_Wide)((uintptr_t)currentip + (uintptr_t)op->data));
else if (op->op == OP_JMPPOP) {
jsi_JmpPopInfo *jp = (jsi_JmpPopInfo*)op->data;
snprintf(bp, bsiz, "{%d},%d\t#%d", jp->off, jp->topop, currentip + jp->off);
}
else if (op->op == OP_STRY) {
jsi_TryInfo *t = (jsi_TryInfo *)op->data;
snprintf(bp, bsiz, "{try:%d, catch:%d, final:%d}", t->trylen, t->catchlen, t->finallen);
}
} | 557 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsiDumpInstr | jsiDumpInstr( Jsi_Interp * interp , jsi_Pstate * ps , Jsi_Value * _this , jsi_TryList * trylist , jsi_OpCode * ip , Jsi_OpCodes * opcodes) | ['interp', 'ps', '_this', 'trylist', 'ip', 'opcodes'] | 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[200];
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));
} | 238 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_evalcode | jsi_evalcode( jsi_Pstate * ps , Jsi_Func * func , Jsi_OpCodes * opcodes , jsi_ScopeChain * scope , Jsi_Value * fargs , Jsi_Value * _this , Jsi_Value ** vret) | ['ps', 'func', 'opcodes', 'scope', 'fargs', '_this', 'vret'] | Jsi_RC jsi_evalcode(jsi_Pstate *ps, Jsi_Func *func, Jsi_OpCodes *opcodes,
jsi_ScopeChain *scope, Jsi_Value *fargs,
Jsi_Value *_this,
Jsi_Value **vret)
{
Jsi_Interp *interp = ps->interp;
if (interp->exited)
return JSI_ERROR;
Jsi_RC rc;
jsi_Frame frame = *interp->framePtr;
frame.parent = interp->framePtr;
interp->framePtr = &frame;
frame.parent->child = interp->framePtr = &frame;
frame.ps = ps;
frame.ingsc = scope;
frame.incsc = fargs;
frame.inthis = _this;
frame.opcodes = opcodes;
frame.fileName = ((func && func->script)?func->script:interp->curFile);
frame.funcName = interp->curFunction;
frame.dirName = interp->curDir;
if (frame.fileName && frame.fileName == frame.parent->fileName)
frame.logflag = frame.parent->logflag;
else
frame.logflag = 0;
frame.level = frame.parent->level+1;
frame.evalFuncPtr = func;
frame.arguments = NULL;
// if (func && func->strict)
// frame.strict = 1;
if (interp->curIp)
frame.parent->line = interp->curIp->Line;
frame.ip = interp->curIp;
interp->refCount++;
interp->level++;
Jsi_IncrRefCount(interp, fargs);
rc = jsi_evalcode_sub(ps, opcodes, scope, fargs, _this, *vret);
Jsi_DecrRefCount(interp, fargs);
if (interp->didReturn == 0 && !interp->exited) {
if ((interp->evalFlags&JSI_EVAL_RETURN)==0)
Jsi_ValueMakeUndef(interp, vret);
/*if (interp->framePtr->Sp != oldSp) //TODO: at some point after memory refs???
Jsi_LogBug("Stack not balance after execute script");*/
}
if (frame.arguments)
Jsi_DecrRefCount(interp, frame.arguments);
interp->didReturn = 0;
interp->refCount--;
interp->level--;
interp->framePtr = frame.parent;
interp->framePtr->child = NULL;
interp->curIp = frame.ip;
if (interp->exited)
rc = JSI_ERROR;
return rc;
} | 383 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_evalcode_sub | jsi_evalcode_sub( jsi_Pstate * ps , Jsi_OpCodes * opcodes , jsi_ScopeChain * scope , Jsi_Value * currentScope , Jsi_Value * _this , Jsi_Value * vret) | ['ps', 'opcodes', 'scope', 'currentScope', '_this', 'vret'] | Jsi_RC jsi_evalcode_sub(jsi_Pstate *ps, Jsi_OpCodes *opcodes,
jsi_ScopeChain *scope, Jsi_Value *currentScope,
Jsi_Value *_this, Jsi_Value *vret)
{
Jsi_Interp* interp = ps->interp;
jsi_OpCode *ip = &opcodes->codes[0];
Jsi_RC rc = JSI_OK;
int curLine = 0;
int context_id = ps->_context_id++, lop = -1;
jsi_OpCode *end = &opcodes->codes[opcodes->code_len];
jsi_TryList *trylist = NULL;
bool strict = interp->strict;
const char *curFile = NULL;
if (currentScope->vt != JSI_VT_OBJECT) {
Jsi_LogBug("Eval: current scope is not a object");
return JSI_ERROR;
}
if (interp->maxDepth>0 && interp->level > interp->maxDepth)
rc = Jsi_LogError("Exceeded call depth: %d", interp->level);
while(ip < end && rc == JSI_OK) {
int plop = ip->op;
if (ip->logflag) { // Mask out LogDebug, etc if not enabled.
interp->curIp = ip;
switch (ip->logflag) {
case jsi_Oplf_assert:
if (!interp->asserts) {
ip++;
if (ip->logflag != jsi_Oplf_assert && (ip->op == OP_POP || ip->op == OP_RET))
ip++;
continue;
}
break;
case jsi_Oplf_debug:
if (!interp->logOpts.Debug && !(interp->framePtr->logflag &(1<<jsi_Oplf_debug))) {
ip++;
if (ip->logflag != jsi_Oplf_debug && (ip->op == OP_POP || ip->op == OP_RET))
ip++;
continue;
}
break;
case jsi_Oplf_test:
if (!interp->logOpts.Test && !(interp->framePtr->logflag &(1<<jsi_Oplf_test))) {
ip++;
if (ip->logflag != jsi_Oplf_test && (ip->op == OP_POP || ip->op == OP_RET))
ip++;
continue;
}
break;
case jsi_Oplf_trace:
if (!interp->logOpts.Trace && !(interp->framePtr->logflag &(1<<jsi_Oplf_trace))) {
ip++;
if (ip->logflag != jsi_Oplf_trace && (ip->op == OP_POP || ip->op == OP_RET))
ip++;
continue;
}
break;
default:
break;
}
}
if (interp->interrupted) {
if (!interp->framePtr->tryDepth) {
Jsi_LogError("program interrupted: function=%s", interp->framePtr->funcName);
interp->interrupted = 0;
} else {
interp->interrupted++;
}
rc = JSI_ERROR;
break;
}
if (interp->exited) {
rc = JSI_ERROR;
break;
}
interp->opCnt++;
if (interp->maxOpCnt && interp->opCnt > interp->maxOpCnt) {
puts("EXEC CAP EXCEED");
interp->maxOpCnt += 1000;
rc = Jsi_LogError("Exceeded execution cap: %d", interp->opCnt);
interp->exited = 1;
interp->exitCode = 99;
break;
}
if (interp->traceOp) {
jsiDumpInstr(interp, ps, _this, trylist, ip, opcodes);
}
if (interp->parent && interp->busyCallback && (interp->opCnt%(interp->busyInterval<=0?100000:interp->busyInterval))==0) {
// Handle parent interp events.
if (jsi_FuncIsNoop(interp, interp->busyCallback))
Jsi_EventProcess(interp->parent, -1);
else {
Jsi_DString nStr;
Jsi_DSInit(&nStr);
Jsi_DSPrintf(&nStr, "[\"#Interp_%d\", %d]", interp->objId, interp->opCnt);//TODO: use actual time interval rather than opCnt.
if (Jsi_FunctionInvokeJSON(interp->parent, interp->busyCallback, Jsi_DSValue(&nStr), NULL) != JSI_OK)
rc = JSI_ERROR;
Jsi_DSFree(&nStr);
}
}
ip->hit=1;
#ifndef USE_STATIC_STACK
if ((interp->maxStack-interp->framePtr->Sp)<STACK_MIN_PAD)
jsiSetupStack(interp);
#endif
jsiPush(interp,0);
interp->curIp = ip;
// Carry forward line/file info from previous OPs.
if (!ip->Line)
ip->Line = curLine;
else
curLine = ip->Line;
if (!ip->fname)
ip->fname = curFile;
else
curFile = ip->fname;
if (interp->debugOpts.hook) {
interp->framePtr->fileName = curFile;
interp->framePtr->line = curLine;
if ((rc = (*interp->debugOpts.hook)(interp, curFile, curLine, interp->framePtr->level, interp->curFunction, jsi_opcode_string(ip->op), ip, NULL)) != JSI_OK)
break;
}
switch(ip->op) {
case OP_NOP:
case OP_LASTOP:
break;
case OP_PUSHUND:
Jsi_ValueMakeUndef(interp, &_jsi_STACKIDX(interp->framePtr->Sp));
jsiPush(interp,1);
break;
case OP_PUSHNULL:
Jsi_ValueMakeNull(interp, &_jsi_STACKIDX(interp->framePtr->Sp));
jsiPush(interp,1);
break;
case OP_PUSHBOO:
Jsi_ValueMakeBool(interp, &_jsi_STACKIDX(interp->framePtr->Sp), (uintptr_t)ip->data);
jsiPush(interp,1);
break;
case OP_PUSHNUM:
Jsi_ValueMakeNumber(interp, &_jsi_STACKIDX(interp->framePtr->Sp), (*((Jsi_Number *)ip->data)));
jsiPush(interp,1);
break;
case OP_PUSHSTR: {
Jsi_Value **v = &_jsi_STACKIDX(interp->framePtr->Sp);
Jsi_ValueMakeStringKey(interp, v, (char*)ip->data);
interp->lastPushStr = Jsi_ValueString(interp, *v, NULL);
jsiPush(interp,1);
break;
}
case OP_PUSHVSTR: {
Jsi_String *s = (Jsi_String *)ip->data;
Jsi_Value **v = &_jsi_STACKIDX(interp->framePtr->Sp);
if (s->flags&1)
jsi_ValueMakeBlobDup(interp,v, (uchar*)s->str, s->len);
else {
Jsi_ValueMakeStringKey(interp, v, s->str);
interp->lastPushStr = s->str;
}
jsiPush(interp,1);
break;
}
case OP_PUSHVAR: {
rc = jsi_PushVar(ps, ip, scope, currentScope, context_id);
break;
}
case OP_PUSHFUN: {
jsi_PushFunc(ps, ip, scope, currentScope);
break;
}
case OP_NEWFCALL:
if (interp->maxUserObjs && interp->userObjCnt > interp->maxUserObjs) {
rc = Jsi_LogError("Max 'new' count exceeded");
break;
}
case OP_FCALL: {
/* TODO: need reliable way to capture func string name to handle unknown functions.*/
int discard = ((ip+1)<end && ip[1].op == OP_POP);
switch (jsiEvalFunction(ps, ip, discard)) { /* throw an execption */
case JSI_OK: break;
case JSI_BREAK:
if (interp->framePtr->tryDepth<=0)
interp->isHelp = 1;
JSI_DO_THROW("help");
break;
default:
JSI_DO_THROW("fcall");
}
strict = interp->strict;
/* TODO: new Function return a function without scopechain, add here */
break;
}
case OP_SUBSCRIPT: {
rc = jsi_evalSubscript(interp, _jsi_TOQ, _jsi_TOP, ip, end, currentScope);
break;
}
case OP_ASSIGN: {
Jsi_Value *sval = _jsi_TOP, *dval = _jsi_TOQ;
bool globThis = (sval->vt == JSI_VT_OBJECT && sval->d.obj == interp->csc->d.obj);
if ((uintptr_t)ip->data == 1) {
jsiVarDeref(interp,1);
rc = jsi_ValueAssign(interp, dval, sval, lop);
if (strict && sval->vt == JSI_VT_UNDEF)
rc = jsi_ValueAssignCheck(interp, sval, lop);
jsiPop(interp,1);
} else {
jsiVarDeref(interp, 3);
Jsi_Value *v3 = _jsi_STACKIDX(interp->framePtr->Sp-3);
if (v3->vt == JSI_VT_OBJECT) {
if (strict && sval->vt == JSI_VT_UNDEF)
rc = jsi_ValueAssignCheck(interp, sval, lop);
jsi_ValueObjKeyAssign(interp, v3, dval, sval, 0);
jsi_ValueDebugLabel(sval, "assign", NULL);
} else if (strict)
rc = Jsi_LogError("assign to a non-exist object");
jsiClearStack(interp,3);
Jsi_ValueCopy(interp,v3, sval);
dval = v3;
jsiPop(interp, 2);
}
if (interp->framePtr->level<=1 && globThis && rc == JSI_OK && dval && dval->vt == JSI_VT_VARIABLE) {
dval = dval->d.lval;
//printf("GLOBAL THIS: %p\n", dval);
Jsi_HashSet(interp->genValueTbl, dval, dval);
}
break;
}
case OP_PUSHREG: {
Jsi_Obj *obj = Jsi_ObjNewType(interp, JSI_OT_REGEXP);
obj->d.robj = (Jsi_Regex *)ip->data;
Jsi_ValueMakeObject(interp, &_jsi_STACKIDX(interp->framePtr->Sp), obj);
jsiPush(interp,1);
break;
}
case OP_PUSHARG:
//Jsi_ValueCopy(interp,_jsi_STACKIDX(interp->framePtr->Sp), currentScope);
if (!interp->framePtr->arguments) {
interp->framePtr->arguments = Jsi_ValueNewObj(interp,
Jsi_ObjNewArray(interp, currentScope->d.obj->arr, currentScope->d.obj->arrCnt, 0));
Jsi_IncrRefCount(interp, interp->framePtr->arguments);
if (interp->hasCallee) {
Jsi_Value *callee = Jsi_ValueObjLookup(interp, currentScope, "\1callee\1", 0);
if (callee)
Jsi_ValueInsert(interp, interp->framePtr->arguments, "\1callee\1", callee, JSI_OM_DONTENUM);
}
// interp->framePtr->arguments->d.obj->__proto__ = interp->Object_prototype; // ecma
}
Jsi_ValueCopy(interp,_jsi_STACKIDX(interp->framePtr->Sp), interp->framePtr->arguments);
jsiPush(interp,1);
break;
case OP_PUSHTHS: { //TODO: Value copy can cause memory leak!
Jsi_Value *tval = _jsi_STACKIDX(interp->framePtr->Sp);
Jsi_ValueCopy(interp, tval, _this);
/*if (interp->csc == _this)
Jsi_ValueDup2(interp, &tval, _this);
else
Jsi_ValueCopy(interp, tval, _this);*/
jsiPush(interp,1);
break;
}
case OP_PUSHTOP:
Jsi_ValueCopy(interp,_jsi_STACKIDX(interp->framePtr->Sp), _jsi_TOP);
jsiPush(interp,1);
break;
case OP_UNREF:
jsiVarDeref(interp,1);
break;
case OP_PUSHTOP2: {
Jsi_Value *vp1 = _jsi_STACKIDX(interp->framePtr->Sp);
Jsi_Value *vp2 = _jsi_STACKIDX(interp->framePtr->Sp+1);
if (!vp1 || !vp2)
rc = Jsi_LogError("Invalid lookup/push");
else {
Jsi_ValueCopy(interp, vp1, _jsi_TOQ);
Jsi_ValueCopy(interp, vp2, _jsi_TOP);
jsiPush(interp, 2);
}
break;
}
case OP_CHTHIS: {
if (ip->data) {
int t = interp->framePtr->Sp - 2;
Assert(t>=0);
Jsi_Value *v = _jsi_THISIDX(t);
jsiClearThis(interp, t);
Jsi_ValueCopy(interp, v, _jsi_TOQ);
if (v->vt == JSI_VT_VARIABLE) {
Jsi_ValueCopy(interp, v, v->d.lval);
}
Jsi_ValueToObject(interp, v);
}
break;
}
case OP_LOCAL: {
Jsi_Value key = VALINIT, *kPtr = &key; // Note we use a string key so no reset needed.
Jsi_ValueMakeStringKey(interp, &kPtr, (char*)ip->data);
jsi_ValueObjKeyAssign(interp, currentScope, kPtr, NULL, JSI_OM_DONTENUM);
context_id = ps->_context_id++;
break;
}
case OP_POP: {
Jsi_Value *tval = _jsi_TOP;
if ((interp->evalFlags&JSI_EVAL_RETURN) && (ip+1) >= end &&
(Jsi_ValueIsObjType(interp, tval, JSI_OT_ITER)==0 &&
Jsi_ValueIsObjType(interp, tval, JSI_OT_FUNCTION)==0)) {
/* Interactive and last instruction is a pop: save result. */
Jsi_ValueMove(interp, vret, tval); /*TODO***: correct ***/
tval->vt = JSI_VT_UNDEF;
}
jsiPop(interp, (uintptr_t)ip->data);
break;
}
case OP_NEG:
jsiVarDeref(interp,1);
Jsi_ValueToNumber(interp, _jsi_TOP);
rc = _jsi_StrictChk(_jsi_TOP);
_jsi_TOP->d.num = -(_jsi_TOP->d.num);
break;
case OP_POS:
jsiVarDeref(interp,1);
Jsi_ValueToNumber(interp, _jsi_TOP);
rc = _jsi_StrictChk(_jsi_TOP);
break;
case OP_NOT: {
int val = 0;
jsiVarDeref(interp,1);
val = Jsi_ValueIsTrue(interp, _jsi_TOP);
jsiClearStack(interp,1);
Jsi_ValueMakeBool(interp, &_jsi_TOP, !val);
break;
}
case OP_BNOT: {
jsiVarDeref(interp,1);
jsi_ValueToOInt32(interp, _jsi_TOP);
rc = _jsi_StrictChk(_jsi_TOP);
_jsi_TOP->d.num = (Jsi_Number)(~((int)_jsi_TOP->d.num));
break;
}
case OP_ADD: {
jsiVarDeref(interp,2);
Jsi_Value *v, *v1 = _jsi_TOP, *v2 = _jsi_TOQ;
int l1, l2;
if (strict)
if (Jsi_ValueIsUndef(interp, v1) || Jsi_ValueIsUndef(interp, v2)) {
rc = Jsi_LogError("operand value to + is undefined");
break;
}
char *s1 = Jsi_ValueString(interp, v1, &l1);
char *s2 = Jsi_ValueString(interp, v2, &l2);
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);
str = (char*)Jsi_Malloc(l1+l2+1);
memcpy(str, s2, l2);
memcpy(str+l2, s1, l1);
str[l1+l2] = 0;
jsiClearStack(interp,2);
Jsi_ValueMakeBlob(interp, &v2, (uchar*)str, l1+l2);
} else {
Jsi_ValueToNumber(interp, v1);
Jsi_ValueToNumber(interp, v2);
rc = _jsi_StrictChk2(v1, v2);
Jsi_Number n = v1->d.num + v2->d.num;
jsiClearStack(interp,2);
Jsi_ValueMakeNumber(interp, &v2, n);
}
jsiPop(interp,1);
break;
}
case OP_IN: {
Jsi_Value *v, *vl;
const char *cp = NULL;
Jsi_Number nval;
jsiVarDeref(interp,2);
vl = _jsi_TOQ;
v = _jsi_TOP;
if (Jsi_ValueIsString(interp,vl))
cp = Jsi_ValueGetStringLen(interp, vl, NULL);
else if (Jsi_ValueIsNumber(interp,vl))
Jsi_ValueGetNumber(interp, vl, &nval);
else {
if (strict)
Jsi_LogWarn("expected string or number before IN");
Jsi_ValueMakeBool(interp, &_jsi_TOQ, 0);
jsiPop(interp,1);
break;
}
if (v->vt == JSI_VT_VARIABLE) {
v = v->d.lval;
SIGASSERT(v, VALUE);
}
if (v->vt != JSI_VT_OBJECT || v->d.obj->ot != JSI_OT_OBJECT) {
if (strict)
Jsi_LogWarn("expected object after IN");
Jsi_ValueMakeBool(interp, &_jsi_TOQ, 0);
jsiPop(interp,1);
break;
}
int bval = 0;
char nbuf[100];
Jsi_Value *vv;
Jsi_Obj *obj = v->d.obj;
if (!cp) {
snprintf(nbuf, sizeof(nbuf), "%d", (int)nval);
cp = nbuf;
}
if (obj->arr) {
vv = jsi_ObjArrayLookup(interp, obj, (char*)cp);
} else {
vv = Jsi_TreeObjGetValue(obj, (char*)cp, 1);
}
bval = (vv != 0);
Jsi_ValueMakeBool(interp, &_jsi_TOQ, bval);
jsiPop(interp,1);
break;
}
case OP_SUB:
common_math_opr(-); break;
case OP_MUL:
common_math_opr(*); break;
case OP_DIV:
common_math_opr(/); break;
case OP_MOD: {
jsiVarDeref(interp,2);
if (!Jsi_ValueIsType(interp,_jsi_TOP, JSI_VT_NUMBER))
Jsi_ValueToNumber(interp, _jsi_TOP);
if (!Jsi_ValueIsType(interp,_jsi_TOQ, JSI_VT_NUMBER))
Jsi_ValueToNumber(interp, _jsi_TOQ);
rc = _jsi_StrictChk2(_jsi_TOP,_jsi_TOQ);
if (rc == JSI_OK)
_jsi_TOQ->d.num = fmod(_jsi_TOQ->d.num, _jsi_TOP->d.num);
jsiPop(interp,1);
break;
}
case OP_LESS:
jsiVarDeref(interp,2);
rc = jsi_logic_less(interp,2,1);
jsiPop(interp,1);
break;
case OP_GREATER:
jsiVarDeref(interp,2);
rc = jsi_logic_less(interp,1,2);
jsiPop(interp,1);
break;
case OP_LESSEQU:
jsiVarDeref(interp,2);
rc = jsi_logic_less(interp,1,2);
if (rc == JSI_OK)
_jsi_TOQ->d.val = !_jsi_TOQ->d.val;
jsiPop(interp,1);
break;
case OP_GREATEREQU:
jsiVarDeref(interp,2);
rc = jsi_logic_less(interp,2,1);
if (rc == JSI_OK)
_jsi_TOQ->d.val = !_jsi_TOQ->d.val;
jsiPop(interp,1);
break;
case OP_EQUAL:
case OP_NOTEQUAL: {
jsiVarDeref(interp,2);
int r = Jsi_ValueCmp(interp, _jsi_TOP, _jsi_TOQ, 0);
r = (ip->op == OP_EQUAL ? !r : r);
jsiClearStack(interp,2);
Jsi_ValueMakeBool(interp, &_jsi_TOQ, r);
jsiPop(interp,1);
break;
}
case OP_STRICTEQU:
case OP_STRICTNEQ: {
int r = 0;
jsiVarDeref(interp,2);
rc = _jsi_StrictUChk3(_jsi_TOQ, _jsi_TOP);
r = !Jsi_ValueIsEqual(interp, _jsi_TOP, _jsi_TOQ);
r = (ip->op == OP_STRICTEQU ? !r : r);
jsiClearStack(interp,2);
Jsi_ValueMakeBool(interp, &_jsi_TOQ, r);
jsiPop(interp,1);
break;
}
case OP_BAND:
common_bitwise_opr(&); break;
case OP_BOR:
common_bitwise_opr(|); break;
case OP_BXOR:
common_bitwise_opr(^); break;
case OP_SHF: {
jsiVarDeref(interp,2);
jsi_ValueToOInt32(interp, _jsi_TOQ);
jsi_ValueToOInt32(interp, _jsi_TOP);
int t1 = (int)_jsi_TOQ->d.num;
int t2 = ((unsigned int)_jsi_TOP->d.num) & 0x1f;
if (ip->data) { /* shift right */
if ((uintptr_t)ip->data == 2) { /* unsigned shift */
unsigned int t3 = (unsigned int)t1;
t3 >>= t2;
Jsi_ValueMakeNumber(interp, &_jsi_TOQ, t3);
} else {
t1 >>= t2;
Jsi_ValueMakeNumber(interp, &_jsi_TOQ, t1);
}
} else {
t1 <<= t2;
Jsi_ValueMakeNumber(interp, &_jsi_TOQ, t1);
}
jsiPop(interp,1);
break;
}
case OP_KEY: {
jsiVarDeref(interp,1);
if (ip->isof && !Jsi_ValueIsArray(interp, _jsi_TOP)) {
rc = Jsi_LogError("operand not an array");
break;
}
if (_jsi_TOP->vt != JSI_VT_UNDEF && _jsi_TOP->vt != JSI_VT_NULL)
Jsi_ValueToObject(interp, _jsi_TOP);
Jsi_Value *spret = Jsi_ValueNew1(interp);
jsi_ValueObjGetKeys(interp, _jsi_TOP, spret, ip->isof);
Jsi_ValueReplace(interp, _jsi_STACK+interp->framePtr->Sp, spret);
Jsi_DecrRefCount(interp, spret);
jsiPush(interp,1);
break;
}
case OP_NEXT: {
Jsi_Value *toq = _jsi_TOQ, *top = _jsi_TOP;
if (toq->vt != JSI_VT_OBJECT || toq->d.obj->ot != JSI_OT_ITER) Jsi_LogBug("next: toq not a iter\n");
if (top->vt != JSI_VT_VARIABLE) {
rc = Jsi_LogError ("invalid for/in left hand-side");
break;
}
if (strict && top->f.bits.local==0) {
const char *varname = "";
Jsi_Value *v = top->d.lval;
if (v->f.bits.lookupfailed)
varname = v->d.lookupFail;
rc = Jsi_LogError("function created global: \"%s\"", varname);
break;
}
Jsi_IterObj *io = toq->d.obj->d.iobj;
if (io->iterCmd) {
io->iterCmd(io, top, _jsi_STACKIDX(interp->framePtr->Sp-3), io->iter++);
} else {
while (io->iter < io->count) {
if (!io->isArrayList) {
if (Jsi_ValueKeyPresent(interp, _jsi_STACKIDX(interp->framePtr->Sp-3), io->keys[io->iter],1))
break;
} else {
while (io->cur < io->obj->arrCnt) {
if (io->obj->arr[io->cur]) break;
io->cur++;
}
if (io->cur >= io->obj->arrCnt) {
/* TODO: Is this really a bug??? */
/* Jsi_LogBug("NOT FOUND LIST ARRAY");*/
io->iter = io->count;
break;
} else if (io->obj->arr[io->cur]) {
io->cur++;
break;
}
}
io->iter++;
}
if (io->iter >= io->count) {
jsiClearStack(interp,1);
Jsi_ValueMakeNumber(interp, &_jsi_TOP, 0);
} else {
Jsi_Value **vPtr = &_jsi_TOP->d.lval, *v = *vPtr;
SIGASSERT(v, VALUE);
Jsi_ValueReset(interp, vPtr);
if (io->isArrayList) {
if (!io->isof)
Jsi_ValueMakeNumber(interp, &v, io->cur-1);
else if (!io->obj->arr[io->cur-1])
Jsi_ValueMakeNull(interp, &v);
else
Jsi_ValueCopy(interp, v, io->obj->arr[io->cur-1]);
} else
Jsi_ValueMakeStringKey(interp, &v, io->keys[io->iter]);
io->iter++;
jsiClearStack(interp,1);
Jsi_ValueMakeNumber(interp, &_jsi_TOP, 1);
}
break;
}
}
case OP_INC:
case OP_DEC: {
int inc = ip->op == OP_INC ? 1 : -1;
if (_jsi_TOP->vt != JSI_VT_VARIABLE) {
rc = Jsi_LogError("operand not left value");
break;
}
Jsi_Value *v = _jsi_TOP->d.lval;
SIGASSERT(v, VALUE);
Jsi_ValueToNumber(interp, v);
rc = _jsi_StrictChk(v);
v->d.num += inc;
jsiVarDeref(interp,1);
if (ip->data) {
_jsi_TOP->d.num -= inc;
}
break;
}
case OP_TYPEOF: {
const char *typ;
Jsi_Value *v = _jsi_TOP;
if (v->vt == JSI_VT_VARIABLE) {
v = v->d.lval;
SIGASSERT(v, VALUE);
}
typ = Jsi_ValueTypeStr(interp, v);
jsiVarDeref(interp,1);
Jsi_ValueMakeStringKey(interp, &_jsi_TOP, (char*)typ);
break;
}
case OP_INSTANCEOF: {
jsiVarDeref(interp,2);
int bval = Jsi_ValueInstanceOf(interp, _jsi_TOQ, _jsi_TOP);
jsiPop(interp,1);
Jsi_ValueMakeBool(interp, &_jsi_TOP, bval);
break;
}
case OP_JTRUE:
case OP_JFALSE:
case OP_JTRUE_NP:
case OP_JFALSE_NP: {
jsiVarDeref(interp,1);
int off = (uintptr_t)ip->data - 1;
int r = Jsi_ValueIsTrue(interp, _jsi_TOP);
if (ip->op == OP_JTRUE || ip->op == OP_JFALSE) jsiPop(interp,1);
ip += ((ip->op == OP_JTRUE || ip->op == OP_JTRUE_NP) ^ r) ? 0 : off;
break;
}
case OP_JMPPOP:
jsiPop(interp, ((jsi_JmpPopInfo *)ip->data)->topop);
case OP_JMP: {
int off = (ip->op == OP_JMP ? (uintptr_t)ip->data - 1
: (uintptr_t)((jsi_JmpPopInfo *)ip->data)->off - 1);
while (1) {
if (trylist == NULL) break;
jsi_OpCode *tojmp = ip + off;
/* jmp out of a try block, should execute the finally block */
/* while jmp out a 'with' block, restore the scope */
if (trylist->type == jsi_TL_TRY) {
if (tojmp >= trylist->d.td.tstart && tojmp < trylist->d.td.fend) break;
if (ip >= trylist->d.td.tstart && ip < trylist->d.td.cend) {
trylist->d.td.last_op = jsi_LOP_JMP;
trylist->d.td.ld.tojmp = tojmp;
ip = trylist->d.td.fstart - 1;
off = 0;
break;
} else if (ip >= trylist->d.td.fstart && ip < trylist->d.td.fend) {
pop_try(trylist);
} else Jsi_LogBug("jmp within a try, but not in its scope?");
} else {
/* with block */
if (tojmp >= trylist->d.wd.wstart && tojmp < trylist->d.wd.wend) break;
JSI_RESTORE_SCOPE();
pop_try(trylist);
}
}
ip += off;
break;
}
case OP_EVAL: {
int stackargc = (uintptr_t)ip->data;
jsiVarDeref(interp, stackargc);
int r = 0;
Jsi_Value *spPtr = Jsi_ValueNew1(interp);
if (stackargc > 0) {
if (_jsi_STACKIDX(interp->framePtr->Sp - stackargc)->vt == JSI_VT_UNDEF) {
Jsi_LogError("undefined value to eval()");
goto undef_eval;
}
int plen;
char *pro = Jsi_ValueString(interp, _jsi_STACKIDX(interp->framePtr->Sp - stackargc), &plen);
if (pro) {
pro = Jsi_StrdupLen(pro, plen);
r = jsiEvalOp(interp, ps, pro, scope, currentScope, _this, &spPtr);
Jsi_Free(pro);
} else {
Jsi_ValueCopy(interp, spPtr, _jsi_STACKIDX(interp->framePtr->Sp - stackargc));
}
}
undef_eval:
jsiPop(interp, stackargc);
Jsi_ValueCopy(interp, _jsi_STACK[interp->framePtr->Sp], spPtr); /*TODO: is this correct?*/
Jsi_DecrRefCount(interp, spPtr);
jsiPush(interp,1);
if (r) {
JSI_DO_THROW("eval");
}
break;
}
case OP_RET: {
if (interp->framePtr->Sp>=1 && ip->data) {
jsiVarDeref(interp,1);
Jsi_ValueMove(interp, vret, _jsi_TOP);
}
jsiPop(interp, (uintptr_t)ip->data);
interp->didReturn = 1;
if (trylist) {
while (trylist) {
if (trylist->type == jsi_TL_TRY && trylist->inCatch)
JSI_RESTORE_SCOPE();
pop_try(trylist);
}
goto done;
}
ip = end;
break;
}
case OP_DELETE: {
int count = (uintptr_t)ip->data;
if (count == 1) { // Non-standard.
if (_jsi_TOP->vt != JSI_VT_VARIABLE)
rc = Jsi_LogError("delete a right value");
else {
Jsi_Value **vPtr = &_jsi_TOP->d.lval, *v = *vPtr;
SIGASSERT(v, VALUE);
if (v->f.bits.dontdel) {
if (strict) rc = Jsi_LogWarn("delete not allowed");
} else if (v != currentScope) {
Jsi_ValueReset(interp,vPtr); /* not allow to delete arguments */
}
else if (strict)
Jsi_LogWarn("Delete arguments");
}
jsiPop(interp,1);
} else if (count == 2) {
jsiVarDeref(interp,2);
assert(interp->framePtr->Sp>=2);
if (strict) {
if (_jsi_TOQ->vt != JSI_VT_OBJECT) Jsi_LogWarn("delete non-object key, ignore");
if (_jsi_TOQ->d.obj == currentScope->d.obj) Jsi_LogWarn("Delete arguments");
}
jsi_ValueObjDelete(interp, _jsi_TOQ, _jsi_TOP, 0);
jsiPop(interp,2);
} else Jsi_LogBug("delete");
break;
}
case OP_OBJECT: {
int itemcount = (uintptr_t)ip->data;
Assert(itemcount>=0);
jsiVarDeref(interp, itemcount * 2);
Jsi_Obj *obj = Jsi_ObjNewObj(interp, _jsi_STACK+(interp->framePtr->Sp-itemcount*2), itemcount*2);
jsiPop(interp, itemcount * 2 - 1); /* one left */
jsiClearStack(interp,1);
Jsi_ValueMakeObject(interp, &_jsi_TOP, obj);
break;
}
case OP_ARRAY: {
int itemcount = (uintptr_t)ip->data;
Assert(itemcount>=0);
jsiVarDeref(interp, itemcount);
Jsi_Obj *obj = Jsi_ObjNewArray(interp, _jsi_STACK+(interp->framePtr->Sp-itemcount), itemcount, 1);
jsiPop(interp, itemcount - 1);
jsiClearStack(interp,1);
Jsi_ValueMakeObject(interp, &_jsi_TOP, obj);
break;
}
case OP_STRY: {
jsi_TryInfo *ti = (jsi_TryInfo *)ip->data;
jsi_TryList *n = jsi_trylist_new(jsi_TL_TRY, scope, currentScope);
n->d.td.tstart = ip; /* make every thing pointed to right pos */
n->d.td.tend = n->d.td.tstart + ti->trylen;
n->d.td.cstart = n->d.td.tend + 1;
n->d.td.cend = n->d.td.tend + ti->catchlen;
n->d.td.fstart = n->d.td.cend + 1;
n->d.td.fend = n->d.td.cend + ti->finallen;
n->d.td.tsp = interp->framePtr->Sp;
n->inCatch=0;
n->inFinal=0;
jsi_push_try(interp, &trylist, n);
break;
}
case OP_ETRY: { /* means nothing happen go to final */
if (trylist == NULL || trylist->type != jsi_TL_TRY)
Jsi_LogBug("Unexpected ETRY opcode??");
ip = trylist->d.td.fstart - 1;
break;
}
case OP_SCATCH: {
if (trylist == NULL || trylist->type != jsi_TL_TRY)
Jsi_LogBug("Unexpected SCATCH opcode??");
if (!ip->data) {
JSI_DO_THROW("catch");
} else {
trylist->inCatch=1;
/* new scope and make var */
scope = jsi_ScopeChainDupNext(interp, scope, currentScope);
currentScope = jsi_ObjValueNew(interp);
interp->framePtr->ingsc = scope; //TODO: changing frame
interp->framePtr->incsc = currentScope;
Jsi_IncrRefCount(interp, currentScope);
Jsi_Value *excpt = Jsi_ValueNew1(interp);
if (ps->last_exception && ps->last_exception->vt != JSI_VT_UNDEF) {
//TODO: fix test262 crash in [email protected]:565 for last_exception which is
// freed in [email protected]:251. Is this code the problem?
Jsi_Value *ple = ps->last_exception;
Jsi_ValueCopy(interp, excpt, ple);
Jsi_ValueReset(interp, &ps->last_exception);
} else if (interp->errMsgBuf[0]) {
Jsi_ValueMakeStringDup(interp, &excpt, interp->errMsgBuf);
interp->errMsgBuf[0] = 0;
}
Jsi_ValueInsert(interp, currentScope, (char*)ip->data, excpt, JSI_OM_DONTENUM);
Jsi_DecrRefCount(interp, excpt);
context_id = ps->_context_id++;
}
break;
}
case OP_ECATCH: {
if (trylist == NULL || trylist->type != jsi_TL_TRY)
Jsi_LogBug("Unexpected ECATCH opcode??");
trylist->inCatch=0;
ip = trylist->d.td.fstart - 1;
break;
}
case OP_SFINAL: {
if (trylist == NULL || trylist->type != jsi_TL_TRY)
Jsi_LogBug("Unexpected SFINAL opcode??");
/* restore scatch scope chain */
trylist->inFinal = 1;
JSI_RESTORE_SCOPE();
break;
}
case OP_EFINAL: {
if (trylist == NULL || trylist->type != jsi_TL_TRY)
Jsi_LogBug("Unexpected EFINAL opcode??");
trylist->inFinal = 0;
int last_op = trylist->d.td.last_op;
jsi_OpCode *tojmp = (last_op == jsi_LOP_JMP ? trylist->d.td.ld.tojmp : 0);
pop_try(trylist);
if (last_op == jsi_LOP_THROW) {
JSI_DO_THROW("finally");
} else if (last_op == jsi_LOP_JMP) {
while (1) {
if (trylist == NULL) {
ip = tojmp;
break;
}
/* same as jmp opcode, see above */
if (trylist->type == jsi_TL_TRY) {
if (tojmp >= trylist->d.td.tstart && tojmp < trylist->d.td.fend) {
ip = tojmp;
break;
}
if (ip >= trylist->d.td.tstart && ip < trylist->d.td.cend) {
trylist->d.td.last_op = jsi_LOP_JMP;
trylist->d.td.ld.tojmp = tojmp;
ip = trylist->d.td.fstart - 1;
break;
} else if (ip >= trylist->d.td.fstart && ip < trylist->d.td.fend) {
pop_try(trylist);
} else Jsi_LogBug("jmp within a try, but not in its scope?");
} else { /* 'with' block */
if (tojmp >= trylist->d.wd.wstart && tojmp < trylist->d.wd.wend) {
ip = tojmp;
break;
}
JSI_RESTORE_SCOPE();
pop_try(trylist);
}
}
}
break;
}
case OP_THROW: {
jsiVarDeref(interp,1);
Jsi_ValueDup2(interp,&ps->last_exception, _jsi_TOP);
interp->didReturn = 1; /* TODO: could possibly hide _jsi_STACK problem */
JSI_DO_THROW("throw");
break;
}
case OP_WITH: {
static int warnwith = 1;
if (strict && warnwith && interp->typeCheck.nowith) {
warnwith = 0;
rc = Jsi_LogError("use of with is illegal due to \"use nowith\"");
break;
}
jsiVarDeref(interp,1);
Jsi_ValueToObject(interp, _jsi_TOP);
jsi_TryList *n = jsi_trylist_new(jsi_TL_WITH, scope, currentScope);
n->d.wd.wstart = ip;
n->d.wd.wend = n->d.wd.wstart + (uintptr_t)ip->data;
jsi_push_try(interp, &trylist, n);
interp->framePtr->withDepth++;
/* make expr to top of scope chain */
scope = jsi_ScopeChainDupNext(interp, scope, currentScope);
currentScope = Jsi_ValueNew1(interp);
interp->framePtr->ingsc = scope;
interp->framePtr->incsc = currentScope;
Jsi_ValueCopy(interp, currentScope, _jsi_TOP);
jsiPop(interp,1);
context_id = ps->_context_id++;
break;
}
case OP_EWITH: {
if (trylist == NULL || trylist->type != jsi_TL_WITH)
Jsi_LogBug("Unexpected EWITH opcode??");
JSI_RESTORE_SCOPE();
pop_try(trylist);
interp->framePtr->withDepth--;
break;
}
case OP_DEBUG: {
jsi_DebuggerStmt();
jsiPush(interp,1);
break;
}
case OP_RESERVED: {
jsi_ReservedInfo *ri = (jsi_ReservedInfo *)ip->data;
const char *cmd = ri->type == RES_CONTINUE ? "continue" : "break";
/* TODO: continue/break out of labeled scope: see tests/prob/break.jsi. */
if (ri->label) {
Jsi_LogError("%s: label(%s) not found", cmd, ri->label);
} else {
Jsi_LogError("%s must be inside loop(or switch)", cmd);
}
rc = JSI_ERROR;
break;
}
#ifndef __cplusplus
default:
Jsi_LogBug("invalid op ceod: %d", ip->op);
#endif
}
lop = plop;
ip++;
}
done:
while (trylist) {
JSI_RESTORE_SCOPE();
pop_try(trylist);
}
return rc;
} | 6559 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_evalprint | jsi_evalprint( Jsi_Value * v) | ['v'] | static const char *jsi_evalprint(Jsi_Value *v)
{
static char buf[100];
if (!v)
return "nil";
if (v->vt == JSI_VT_NUMBER) {
snprintf(buf, 100, "NUM:%" JSI_NUMGFMT " ", v->d.num);
} else if (v->vt == JSI_VT_BOOL) {
snprintf(buf, 100, "BOO:%d", v->d.val);
} else if (v->vt == JSI_VT_STRING) {
snprintf(buf, 100, "STR:'%s'", v->d.s.str);
} else if (v->vt == JSI_VT_VARIABLE) {
snprintf(buf, 100, "VAR:%p", v->d.lval);
} else if (v->vt == JSI_VT_NULL) {
snprintf(buf, 100, "NULL");
} else if (v->vt == JSI_VT_OBJECT) {
snprintf(buf, 100, "OBJ:%p", v->d.obj);
} else if (v->vt == JSI_VT_UNDEF) {
snprintf(buf, 100, "UNDEFINED");
}
return buf;
} | 199 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_GetHomeDir | jsi_GetHomeDir( Jsi_Interp * interp) | ['interp'] | const char *jsi_GetHomeDir(Jsi_Interp *interp) {
const char *str = NULL;
if (interp->homeDir)
return interp->homeDir;
#ifdef __WIN32
str = getenv("USERPROFILE"); /* TODO: windows home dir. */
#else
if ((str = getenv("HOME")) == NULL) {
struct passwd pwd, *pw;
char buf[20000];
if (getpwuid_r(getuid(), &pwd, buf, sizeof(buf), &pw) == 0 && pw->pw_dir)
str = pw->pw_dir;
}
#endif
if (!str) {
Jsi_LogBug("no home dir");
str = "/";
}
#ifdef JSI_LITE_ONLY
return str;
#else
return (interp->homeDir = Jsi_KeyAdd(interp, str));
#endif
} | 128 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArgTypeCheck | jsi_ArgTypeCheck( Jsi_Interp * interp , int typ , Jsi_Value * arg , const char * p1 , const char * p2 , int index , Jsi_Func * func , bool isdefault) | ['interp', 'typ', 'arg', 'p1', 'p2', 'index', 'func', 'isdefault'] | Jsi_RC jsi_ArgTypeCheck(Jsi_Interp *interp, int typ, Jsi_Value *arg, const char *p1,
const char *p2, int index, Jsi_Func *func, bool isdefault) {
Jsi_RC rc = JSI_OK;
char idxBuf[200];
idxBuf[0] = 0;
if (func && arg->vt == JSI_VT_UNDEF && !interp->typeCheck.noundef && index>0 && !isdefault && !(typ&JSI_TT_UNDEFINED)) {
snprintf(idxBuf, sizeof(idxBuf), " arg %d", index);
jsi_TypeMismatch(interp);
Jsi_DString fStr = {};
rc = Jsi_LogType("call with undefined var %s%s '%s'%s", p1, idxBuf, p2, jsiFuncInfo(interp, &fStr, func, arg));
Jsi_DSFree(&fStr);
return rc;
}
if (typ <= 0)
return JSI_OK;
//if (typ&JSI_TT_VOID)
// return JSI_OK;
if (interp->typeCheck.all==0) {
if (func ? (interp->typeCheck.run==0) : (interp->typeCheck.parse==0))
return JSI_OK;
}
if (index == 0 && func && func->type == FC_BUILDIN &&
interp->typeCheck.all == 0) // Normally do not check return types for builtins.
return JSI_OK;
if ((typ&JSI_TT_ANY)) return JSI_OK;
if (index == 0 && arg->vt == JSI_VT_UNDEF) {
if (!(typ&JSI_TT_VOID))
goto done;
return JSI_OK;
}
if (isdefault && index && typ&JSI_TT_VOID && arg->vt == JSI_VT_UNDEF)
return JSI_OK;
if (typ&JSI_TT_UNDEFINED && Jsi_ValueIsUndef(interp, arg)) return rc;
if (typ&JSI_TT_NUMBER && Jsi_ValueIsNumber(interp, arg)) return rc;
if (typ&JSI_TT_STRING && Jsi_ValueIsString(interp, arg)) return rc;
if (typ&JSI_TT_BOOLEAN && Jsi_ValueIsBoolean(interp, arg)) return rc;
if (typ&JSI_TT_ARRAY && Jsi_ValueIsArray(interp, arg)) return rc;
if (typ&JSI_TT_FUNCTION && Jsi_ValueIsFunction(interp, arg)) return rc;
if (typ&JSI_TT_REGEXP && Jsi_ValueIsObjType(interp, arg, JSI_OT_REGEXP)) return rc;
if (typ&JSI_TT_USEROBJ && Jsi_ValueIsObjType(interp, arg, JSI_OT_USEROBJ)) return rc;
if (typ&JSI_TT_ITEROBJ && Jsi_ValueIsObjType(interp, arg, JSI_OT_ITER)) return rc;
if (typ&JSI_TT_OBJECT && (
Jsi_ValueIsObjType(interp, arg, JSI_OT_OBJECT) && Jsi_ValueIsArray(interp, arg)==0))
return rc;
if (typ&JSI_TT_NULL && Jsi_ValueIsNull(interp, arg)) return rc;
done:
{
Jsi_DString dStr = {};
const char *exp = jsi_typeName(interp, typ, &dStr);
const char *vtyp = jsi_ValueTypeName(interp, arg);
if (index>0)
snprintf(idxBuf, sizeof(idxBuf), " arg %d", index);
if (interp->typeCheck.error)
rc = JSI_ERROR;
jsi_TypeMismatch(interp);
Jsi_DString fStr = {};
rc = Jsi_LogType("type mismatch %s%s '%s': expected \"%s\" but got \"%s\"%s",
p1, idxBuf, p2, exp, vtyp, jsiFuncInfo(interp, &fStr, func, arg));
Jsi_DSFree(&fStr);
Jsi_DSFree(&dStr);
}
return rc;
} | 596 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_RunFuncCallCheck | jsi_RunFuncCallCheck( Jsi_Interp * interp , Jsi_Func * func , int argc , const char * name , jsi_Pline * line , Jsi_OpCodes * argCodes , bool isParse) | ['interp', 'func', 'argc', 'name', 'line', 'argCodes', 'isParse'] | Jsi_RC jsi_RunFuncCallCheck(Jsi_Interp *interp, Jsi_Func *func, int argc, const char *name, jsi_Pline *line, Jsi_OpCodes *argCodes, bool isParse)
{
Jsi_RC rc = JSI_OK;
if (interp->typeCheck.all==0) {
if (!argCodes ? (interp->typeCheck.run==0) : (interp->typeCheck.parse==0))
return JSI_OK;
}
Jsi_CmdSpec *spec = func->cmdSpec;
Jsi_ScopeStrs *ss = func->argnames;
if (ss==NULL && spec == NULL)
return JSI_OK;
int i, minArgs, maxArgs, mis = 0, varargs = 0;
char nbuf[100];
if (func->type == FC_BUILDIN) {
varargs = (spec->maxArgs<0);
maxArgs = spec->maxArgs + func->callflags.bits.addargs;
minArgs = spec->minArgs + func->callflags.bits.addargs;
} else {
varargs = ss->varargs;
minArgs = (ss->firstDef>0 ? ss->firstDef-1 : ss->count);
maxArgs = ss->count;
mis = (argc != ss->count);
if (func->retType == 0 && ss && ss->typeCnt == 0 && interp->typeCheck.all==0)
return JSI_OK;
}
if (varargs) {
if (argc >= minArgs)
return JSI_OK;
mis = (argc<minArgs);
} else
mis = (argc<minArgs || argc>maxArgs);
if (mis) {
if (varargs)
snprintf(nbuf, sizeof(nbuf), "%d or more", minArgs);
else if (maxArgs > minArgs)
snprintf(nbuf, sizeof(nbuf), "%d-%d", minArgs, maxArgs);
else
snprintf(nbuf, sizeof(nbuf), "%d", maxArgs);
if (line)
interp->parseLine = line;
if (interp->typeCheck.error)
rc = JSI_ERROR;
Jsi_DString dStr = {};
Jsi_FuncObjToString(interp, func, &dStr, 2);
if (isParse)
Jsi_LogWarn("got %d args, expected %s, calling %s", argc, nbuf, Jsi_DSValue(&dStr));
else
rc = Jsi_LogType("got %d args, expected %s, calling %s", argc, nbuf, Jsi_DSValue(&dStr));
jsi_TypeMismatch(interp);
Jsi_DSFree(&dStr);
if (line)
interp->parseLine = NULL;
return rc;
}
if (argCodes && argCodes->code_len>=argc) {
int cl = argCodes->code_len;
int aind=argc-1;
for (i=cl-1; rc == JSI_OK && i>=0 && aind>=0; i--,aind--) {
Jsi_ttype atyp = JSI_TT_ANY;
switch (argCodes->codes[i].op) {
case OP_PUSHSTR: atyp=JSI_TT_STRING; break;
case OP_PUSHNUM: atyp=JSI_TT_NUMBER; break;
case OP_PUSHBOO: atyp=JSI_TT_BOOLEAN; break;
case OP_PUSHFUN: atyp=JSI_TT_FUNCTION; break;
case OP_PUSHTHS: atyp=JSI_TT_OBJECT; break;
case OP_PUSHREG: atyp=JSI_TT_REGEXP; break;
case OP_PUSHUND: atyp=JSI_TT_VOID; break;
case OP_PUSHNULL: atyp=JSI_TT_NULL; break;
case OP_PUSHARG: atyp=JSI_TT_ARRAY; break;
case OP_SUBSCRIPT: i++; break;
case OP_ARRAY: atyp=JSI_TT_ARRAY; i=jsiPopArgs(argCodes, i); break;
case OP_OBJECT: atyp=JSI_TT_OBJECT; i=jsiPopArgs(argCodes, i); break;
default: break;
}
if (atyp == JSI_TT_ANY) continue;
rc = jsi_StaticArgTypeCheck(interp, atyp, "for argument", name, aind+1, func, line);
}
}
return rc;
} | 678 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_StaticArgTypeCheck | jsi_StaticArgTypeCheck( Jsi_Interp * interp , int atyp , const char * p1 , const char * p2 , int index , Jsi_Func * func , jsi_Pline * line) | ['interp', 'atyp', 'p1', 'p2', 'index', 'func', 'line'] | Jsi_RC jsi_StaticArgTypeCheck(Jsi_Interp *interp, int atyp, const char *p1, const char *p2, int index, Jsi_Func *func, jsi_Pline *line) {
Assert(index>0);
Jsi_RC rc;
if (interp->typeCheck.parse==0 && interp->typeCheck.all==0)
return JSI_OK;
int ai = index-1+func->callflags.bits.addargs;
if (func->argnames == NULL || ai>=func->argnames->count || ai<0)
return JSI_OK;
int typ = func->argnames->args[ai].type;
if (typ <= 0)
return JSI_OK;
if (index == 0 && func && func->type == FC_BUILDIN &&
interp->typeCheck.all==0) // Normally do not check return types for builtins.
return JSI_OK;
if ((typ&JSI_TT_ANY)) return JSI_OK;
if (index == 0 && atyp == JSI_VT_UNDEF) {
if (!(typ&JSI_TT_VOID))
goto done;
return JSI_OK;
}
/* if (index == 0 && (typ&JSI_TT_VOID)) {
if (atyp != JSI_VT_UNDEF && !(typ&JSI_TT_UNDEFINED))
goto done;
return JSI_OK;
}*/
if (atyp == JSI_VT_UNDEF)
return JSI_OK;
rc = JSI_OK;
if (typ&JSI_TT_UNDEFINED && atyp == JSI_TT_UNDEFINED) return rc;
if (typ&JSI_TT_NUMBER && atyp==JSI_TT_NUMBER) return rc;
if (typ&JSI_TT_STRING && atyp==JSI_TT_STRING) return rc;
if (typ&JSI_TT_BOOLEAN && atyp==JSI_TT_BOOLEAN) return rc;
if (typ&JSI_TT_ARRAY && atyp==JSI_TT_ARRAY) return rc;
if (typ&JSI_TT_FUNCTION && atyp==JSI_TT_FUNCTION) return rc;
if (typ&JSI_TT_REGEXP && atyp==JSI_TT_REGEXP) return rc;
if (typ&JSI_TT_USEROBJ && atyp==JSI_TT_USEROBJ) return rc;
if (typ&JSI_TT_ITEROBJ && atyp==JSI_TT_ITEROBJ) return rc;
if (typ&JSI_TT_OBJECT && atyp==JSI_TT_OBJECT) return rc;
if (typ&JSI_TT_NULL && atyp==JSI_TT_NULL) return rc;
done:
{
Jsi_DString dStr = {};
const char *exp = jsi_typeName(interp, typ, &dStr);
const char *vtyp = jsi_TypeName(interp, (Jsi_ttype)atyp);
char idxBuf[200];
idxBuf[0] = 0;
if (index>0)
snprintf(idxBuf, sizeof(idxBuf), " arg %d", index);
if (line)
interp->parseLine = line;
if (interp->typeCheck.error)
rc = JSI_ERROR;
jsi_TypeMismatch(interp);
Jsi_DString fStr = {};
rc = Jsi_LogType("type mismatch %s%s '%s': expected \"%s\" but got \"%s\"%s",
p1, idxBuf, p2, exp, vtyp, jsiFuncInfo(interp, &fStr, func, NULL));
Jsi_DSFree(&fStr);
Jsi_DSFree(&dStr);
}
return rc;
} | 493 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_hashFmtKey | jsi_hashFmtKey( Jsi_MapEntry * h , struct Jsi_MapOpts * opts , int flags) | ['h', 'opts', 'flags'] | static Jsi_Value *jsi_hashFmtKey(Jsi_MapEntry* h, struct Jsi_MapOpts *opts, int flags)
{
Jsi_HashEntry* hPtr = (Jsi_HashEntry*)h;
void *key = Jsi_HashKeyGet(hPtr);
if (opts->keyType == JSI_KEYS_ONEWORD)
return Jsi_ValueNewNumber(opts->interp, (Jsi_Number)(intptr_t)key);
char nbuf[100];
snprintf(nbuf, sizeof(nbuf), "%p", key);
return Jsi_ValueNewStringDup(opts->interp, nbuf);
} | 89 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | Jsi_Main | Jsi_Main( Jsi_InterpOpts * opts) | ['opts'] | Jsi_Interp* Jsi_Main(Jsi_InterpOpts *opts)
{
int rc = 0;
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 == 0) {
/* 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)
fputs("ERROR\n", stderr);
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;
} | 1533 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsonNewDString | jsonNewDString( Jsi_Interp * interp , Jsi_DString * dStr , const char * str , int len) | ['interp', 'dStr', 'str', 'len'] | static void jsonNewDString(Jsi_Interp *interp, Jsi_DString *dStr, const char* str, int len)
{
char buf[100], *dp = buf;
const char *cp = str;
int ulen;
while ((cp-str)<len) {
if (*cp == '\\') {
switch (cp[1]) {
case 'b': *dp++ = '\b'; break;
case 'n': *dp++ = '\n'; break;
case 'r': *dp++ = '\r'; break;
case 'f': *dp++ = '\f'; break;
case 't': *dp++ = '\t'; break;
case '\"': *dp++ = '\"'; break;
case '\\': *dp++ = '\\'; break;
case 'u':
if ((ulen=Jsi_UtfDecode(cp+2, dp))) {
dp += ulen;
cp += 4;
} else {
*dp++ = '\\';
*dp++ = 'u';
}
break;
}
cp+=2;
} else {
*dp++ = *cp++;
}
if ((dp-buf)>90) {
*dp = 0;
Jsi_DSAppendLen(dStr, buf, dp-buf);
dp = buf;
}
}
*dp = 0;
Jsi_DSAppendLen(dStr, buf, dp-buf);
} | 256 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | mdbEvalSetColumn | mdbEvalSetColumn( MyDbEvalContext * p , int iCol , Jsi_DString * dStr) | ['p', 'iCol', 'dStr'] | static void mdbEvalSetColumn(MyDbEvalContext *p, int iCol, Jsi_DString *dStr) {
//Jsi_Interp *interp = p->jdb->interp;
char nbuf[200];
MysqlPrep *prep = p->prep;
SqlFieldResults *field = prep->fieldResult+iCol;
Jsi_Interp *interp = p->jdb->interp;
if (field->isnull)
return;
switch(field->jsiTypeMap) {
case JSI_OPTION_STRING: {
int bytes = field->len;
const char *zBlob = field->buffer.vstring;
if( !zBlob ) {
const char *nv = p->jdb->optPtr->nullvalue;
Jsi_DSAppend(dStr, nv?nv:"null", NULL);
return;
}
Jsi_DSAppendLen(dStr, zBlob, bytes);
return;
}
case JSI_OPTION_BOOL: {
snprintf(nbuf, sizeof(nbuf), "%s", field->buffer.vchar?"true":"false");
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case JSI_OPTION_INT64: {
snprintf(nbuf, sizeof(nbuf), "%lld", field->buffer.vlonglong);
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
//case JSI_OPTION_TIME_T:
case JSI_OPTION_TIME_D:
case JSI_OPTION_TIME_W: {
Jsi_Number jtime = mdbMyTimeToJS(&field->buffer.timestamp);
Jsi_NumberToString(interp, jtime, nbuf, sizeof(nbuf));
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case JSI_OPTION_DOUBLE: {
Jsi_NumberToString(interp, field->buffer.vdouble, nbuf, sizeof(nbuf));
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
default:
Jsi_LogWarn("unknown type: %d", field->jsiTypeMap);
}
} | 297 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | mdbEvalSetColumnJSON | mdbEvalSetColumnJSON( MyDbEvalContext * p , int iCol , Jsi_DString * dStr) | ['p', 'iCol', 'dStr'] | static void mdbEvalSetColumnJSON(MyDbEvalContext *p, int iCol, Jsi_DString *dStr) {
Jsi_Interp *interp = p->jdb->interp;
char nbuf[200];
MysqlPrep *prep = p->prep;
SqlFieldResults *field = prep->fieldResult+iCol;
if (field->isnull) {
Jsi_DSAppend(dStr, "null", NULL);
return;
}
const char *zBlob = "";
int bytes = 0;
switch(field->jsiTypeMap) {
case JSI_OPTION_BOOL: {
snprintf(nbuf, sizeof(nbuf), "%s", field->buffer.vchar?"true":"false");
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case JSI_OPTION_INT64: {
snprintf(nbuf, sizeof(nbuf), "%lld", field->buffer.vlonglong);
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case JSI_OPTION_DOUBLE: {
Jsi_NumberToString(interp, field->buffer.vdouble, nbuf, sizeof(nbuf));
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
//case JSI_OPTION_TIME_T:
case JSI_OPTION_TIME_D:
case JSI_OPTION_TIME_W: {
Jsi_Number jtime = mdbMyTimeToJS(&field->buffer.timestamp);
Jsi_NumberToString(interp, jtime, nbuf, sizeof(nbuf));
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case JSI_OPTION_STRING:
zBlob = field->buffer.vstring;
default:
{
if( !zBlob ) {
Jsi_DSAppend(dStr, "null", NULL);
return;
}
Jsi_JSONQuote(interp, zBlob, bytes, dStr);
return;
}
}
} | 286 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | NumberToExponentialCmd | NumberToExponentialCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC NumberToExponentialCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
char buf[100];
int prec = 0, skip = 0;
Jsi_Number num;
Jsi_Value *v;
ChkStringN(_this, funcPtr, v);
if (Jsi_GetIntFromValue(interp, Jsi_ValueArrayIndex(interp, args, skip), &prec) != JSI_OK)
return JSI_ERROR;
if (prec<0) prec = 0;
Jsi_GetDoubleFromValue(interp, v, &num);
snprintf(buf, sizeof(buf), "%.*" JSI_NUMEFMT, prec, num);
#ifdef __WIN32
char *e = strrchr(buf, 'e');
if (e && (e[1]=='+' || e[1]=='-')) {
e++;
int eNum = atoi(e);
if (e[0]=='-')
eNum = -eNum;
e++;
snprintf(e, (e-buf), "%02d", eNum);
}
#endif
Jsi_ValueMakeStringDup(interp, ret, buf);
return JSI_OK;
} | 204 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | NumberToFixedCmd | NumberToFixedCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC NumberToFixedCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
char buf[100];
int prec = 0, skip = 0;
Jsi_Number num;
Jsi_Value *v;
ChkStringN(_this, funcPtr, v);
Jsi_Value *pa = Jsi_ValueArrayIndex(interp, args, skip);
if (pa && Jsi_GetIntFromValue(interp, pa, &prec) != JSI_OK)
return JSI_ERROR;
if (prec<0) prec = 0;
Jsi_GetDoubleFromValue(interp, v, &num);
snprintf(buf, sizeof(buf), "%.*" JSI_NUMFFMT, prec, num);
Jsi_ValueMakeStringDup(interp, ret, buf);
return JSI_OK;
} | 136 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | NumberToPrecisionCmd | NumberToPrecisionCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC NumberToPrecisionCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
char buf[100];
int prec = 0, skip = 0;
Jsi_Number num;
Jsi_Value *v;
ChkStringN(_this, funcPtr, v);
if (Jsi_GetIntFromValue(interp, Jsi_ValueArrayIndex(interp, args, skip), &prec) != JSI_OK)
return JSI_ERROR;
if (prec<=0) return JSI_ERROR;
Jsi_GetDoubleFromValue(interp, v, &num);
snprintf(buf, sizeof(buf),"%.*" JSI_NUMFFMT, prec, num);
if (num<0)
prec++;
buf[prec+1] = 0;
if (buf[prec] == '.')
buf[prec] = 0;
Jsi_ValueMakeStringDup(interp, ret, buf);
return JSI_OK;
} | 161 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | NumberToStringCmd | NumberToStringCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC NumberToStringCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
char buf[500];
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;
} | 231 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_BitfieldToValue | jsi_BitfieldToValue( Jsi_Interp * interp , Jsi_OptionSpec * spec , Jsi_Value ** outValue , Jsi_DString * outStr , void * record , Jsi_Wide flags) | ['interp', 'spec', 'outValue', 'outStr', 'record', 'flags'] | static Jsi_RC jsi_BitfieldToValue(Jsi_Interp *interp, Jsi_OptionSpec* spec, Jsi_Value **outValue,
Jsi_DString *outStr, void *record, Jsi_Wide flags)
{
Jsi_csgset *bsget = spec->init.OPT_BITS;
Jsi_Interp *d = interp;
int idx = spec->idx;
uchar *data = (uchar*)record;
int64_t inum;
Jsi_OptionSpec* enumSpec = (typeof(enumSpec))spec->data;
if (!d || !bsget || idx<0)
return Jsi_LogBug("invalid bitfield");
Jsi_RC rc = (*bsget)(interp, data, &inum, spec, idx, 0);
if (rc != JSI_OK)
return JSI_ERROR;
if (enumSpec) {
struct numStruct { int64_t numVal; } nval = { inum };
Jsi_OptionSpec eSpec[] = {
JSI_OPT(CUSTOM, struct numStruct, 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) ), //TODO: extra
JSI_OPT_END(struct numStruct)
};
if (JSI_OK != jsi_EnumToValue(interp, eSpec, outValue, outStr, (void*)&nval, flags))
return JSI_ERROR;
} else if (outStr) {
char obuf[100];
snprintf(obuf, sizeof(obuf), "%" PRId64, inum);
Jsi_DSAppend(outStr, obuf, NULL);
} else {
Jsi_Number num = (Jsi_Number)inum;
Jsi_ValueMakeNumber(interp, outValue, num);
}
return JSI_OK;
} | 313 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_PstateSetFile | jsi_PstateSetFile( jsi_Pstate * ps , Jsi_Channel fp , int skipbang) | ['ps', 'fp', 'skipbang'] | int jsi_PstateSetFile(jsi_Pstate *ps, Jsi_Channel fp, int skipbang)
{
jsi_Lexer *l = ps->lexer;
jsi_PstateClear(ps);
l->ltype = LT_FILE;
l->d.fp = fp;
Jsi_Rewind(ps->interp, fp);
if (skipbang) {
char buf[1000];
if (Jsi_Gets(ps->interp, fp, buf, 1000) && (buf[0] != '#' || buf[1] != '!')) {
Jsi_Rewind(ps->interp, fp);
}
}
return JSI_OK;
} | 107 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | Jsi_RegExpMatch | Jsi_RegExpMatch( Jsi_Interp * interp , Jsi_Value * pattern , const char * v , int * rc , Jsi_DString * dStr) | ['interp', 'pattern', 'v', 'rc', 'dStr'] | 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[100];
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;
} | 223 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | dbEvalSetColumn | dbEvalSetColumn( DbEvalContext * p , int iCol , Jsi_DString * dStr) | ['p', 'iCol', 'dStr'] | static void dbEvalSetColumn(DbEvalContext *p, int iCol, Jsi_DString *dStr) {
Jsi_Interp *interp = p->jdb->interp;
char nbuf[200];
sqlite3_stmt *pStmt = p->pPreStmt->pStmt;
switch( sqlite3_column_type(pStmt, iCol) ) {
case SQLITE_BLOB: {
int bytes = sqlite3_column_bytes(pStmt, iCol);
const char *zBlob = (char*)sqlite3_column_blob(pStmt, iCol);
if( !zBlob ) {
return;
}
Jsi_DSAppendLen(dStr, zBlob, bytes);
return;
}
case SQLITE_INTEGER: {
sqlite_int64 v = sqlite3_column_int64(pStmt, iCol);
if (v==0 || v==1) {
const char *dectyp = sqlite3_column_decltype(pStmt, iCol);
if (dectyp && !Jsi_Strncasecmp(dectyp,"bool", 4)) {
Jsi_DSAppend(dStr, (v?"true":"false"), NULL);
return;
}
}
#ifdef __WIN32
snprintf(nbuf, sizeof(nbuf), "%" PRId64, (Jsi_Wide)v);
#else
snprintf(nbuf, sizeof(nbuf), "%lld", v);
#endif
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case SQLITE_FLOAT: {
Jsi_NumberToString(interp, sqlite3_column_double(pStmt, iCol), nbuf, sizeof(nbuf));
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case SQLITE_NULL: {
return;
}
}
const char *str = (char*)sqlite3_column_text(pStmt, iCol );
if (!str)
str = p->jdb->optPtr->nullvalue;
Jsi_DSAppend(dStr, str?str:"", NULL);
} | 304 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | dbEvalSetColumnJSON | dbEvalSetColumnJSON( DbEvalContext * p , int iCol , Jsi_DString * dStr) | ['p', 'iCol', 'dStr'] | static void dbEvalSetColumnJSON(DbEvalContext *p, int iCol, Jsi_DString *dStr) {
Jsi_Interp *interp = p->jdb->interp;
char nbuf[200];
sqlite3_stmt *pStmt = p->pPreStmt->pStmt;
switch( sqlite3_column_type(pStmt, iCol) ) {
case SQLITE_BLOB: {
int bytes = sqlite3_column_bytes(pStmt, iCol);
const char *zBlob = (char*)sqlite3_column_blob(pStmt, iCol);
if( !zBlob ) {
Jsi_DSAppend(dStr, "null", NULL);
return;
}
Jsi_JSONQuote(interp, zBlob, bytes, dStr);
return;
}
case SQLITE_INTEGER: {
sqlite_int64 v = sqlite3_column_int64(pStmt, iCol);
if (v==0 || v==1) {
const char *dectyp = sqlite3_column_decltype(pStmt, iCol);
if (dectyp && !Jsi_Strncasecmp(dectyp,"bool", 4)) {
Jsi_DSAppend(dStr, (v?"true":"false"), NULL);
return;
}
}
#ifdef __WIN32
snprintf(nbuf, sizeof(nbuf), "%" PRId64, (Jsi_Wide)v);
#else
snprintf(nbuf, sizeof(nbuf), "%lld", v);
#endif
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case SQLITE_FLOAT: {
Jsi_NumberToString(interp, sqlite3_column_double(pStmt, iCol), nbuf, sizeof(nbuf));
Jsi_DSAppend(dStr, nbuf, NULL);
return;
}
case SQLITE_NULL: {
Jsi_DSAppend(dStr, "null", NULL);
return;
}
}
const char *str = (char*)sqlite3_column_text(pStmt, iCol );
if (!str)
str = p->jdb->optPtr->nullvalue;
Jsi_JSONQuote(interp, str?str:"", -1, dStr);
} | 327 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | dbOutputHexBlob | dbOutputHexBlob( Jsi_DString * dStr , const void * pBlob , int nBlob) | ['dStr', 'pBlob', 'nBlob'] | static void dbOutputHexBlob(Jsi_DString *dStr, const void *pBlob, int nBlob){
int i;
char out[100], *zBlob = (char *)pBlob;
Jsi_DSAppend(dStr, "X'", NULL);
for(i=0; i<nBlob; i++){ snprintf(out, sizeof(out),"%02x",zBlob[i]&0xff);Jsi_DSAppend(dStr, out, NULL); }
Jsi_DSAppend(dStr, "'", NULL);
} | 95 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsiSqlFunc | jsiSqlFunc( sqlite3_context * context , int argc , sqlite3_value ** argv) | ['context', 'argc', 'argv'] | static void jsiSqlFunc(sqlite3_context *context, int argc, sqlite3_value**argv) {
SqlFunc *p = (SqlFunc*)sqlite3_user_data(context);
int i;
int rc;
Jsi_Interp *interp = p->interp;
Jsi_Value *vpargs, *itemsStatic[100], **items = itemsStatic, *ret;
if (argc>100)
items = (Jsi_Value**)Jsi_Calloc(argc, sizeof(Jsi_Value*));
for(i=0; i<argc; i++) {
items[i] = dbGetValueGet(interp, argv[i]);
}
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, items, argc, 0));
Jsi_IncrRefCount(interp, vpargs);
ret = Jsi_ValueNew1(interp);
rc = Jsi_FunctionInvoke(interp, p->tocall, vpargs, &ret, NULL);
Jsi_DecrRefCount(interp, vpargs);
if (items != itemsStatic)
Jsi_Free(items);
bool b;
if( rc != JSI_OK) {
char buf[250];
snprintf(buf, sizeof(buf), "error in function: %.200s", p->zName);
sqlite3_result_error(context, buf, -1);
} else if (Jsi_ValueIsBoolean(interp, ret)) {
Jsi_GetBoolFromValue(interp, ret, &b);
sqlite3_result_int(context, b);
} else if (Jsi_ValueIsNumber(interp, ret)) {
Jsi_Number d;
// if (Jsi_GetIntFromValueBase(interp, ret, &i, 0, JSI_NO_ERRMSG);
// sqlite3_result_int64(context, v);
Jsi_GetNumberFromValue(interp, ret, &d);
sqlite3_result_double(context, (double)d);
} else {
const char * data;
if (!(data = Jsi_ValueGetStringLen(interp, ret, &i))) {
//TODO: handle objects???
data = Jsi_ValueToString(interp, ret, NULL);
i = Jsi_Strlen(data);
}
sqlite3_result_text(context, (char *)data, i, SQLITE_TRANSIENT );
}
Jsi_DecrRefCount(interp, ret);
} | 357 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_DbQuery | jsi_DbQuery( Jsi_Db * jdb , Jsi_CDataDb * dbopts , const char * query) | ['jdb', 'dbopts', 'query'] | static int jsi_DbQuery(Jsi_Db *jdb, Jsi_CDataDb *dbopts, const char *query)
{
int k, cnt, erc = -1;
Jsi_CDataDb statbinds[] = {{}, {}};
if (!dbopts) dbopts = statbinds;
OptionBind ob = {.binds = dbopts};
Jsi_StructSpec *specPtr, *specs;
Jsi_Interp *interp = jdb->interp;
if (!query) query="";
if (query[0]==';') {
if (!dbExecCmd(jdb, query+1, &erc)) {
Jsi_LogError("EXEC ERROR=\"%s\", SQL=\"%s\"", sqlite3_errmsg(jdb->db), query);
return erc;
}
return 0;
}
const char *cPtr = Jsi_Strstr(query, " %s");
if (!cPtr) cPtr = Jsi_Strstr(query, "\t%s");
if (!dbopts) {
Jsi_LogError("dbopts may not be null");
return -1;
}
if (!dbopts[0].data) {
Jsi_LogError("data may not be null");
return -1;
}
if (!dbopts[0].sf) {
Jsi_LogError("specs may not be null");
return -1;
}
for (k=0; dbopts[k].sf; k++) {
if (dbopts[k].arrSize>1 || k==0) {
int scnt = 0;
for (specPtr = dbopts[k].sf, scnt=0; specPtr->id>=JSI_OPTION_BOOL
&& specPtr->id < JSI_OPTION_END; specPtr++, scnt++) {
if (specPtr->flags&JSI_OPT_DB_IGNORE)
continue;
if (k==0) {
if (specPtr->flags&JSI_OPT_DB_ROWID) {
if (specPtr->id != JSI_OPTION_INT64) {
Jsi_LogError("rowid flag must be a wide field: %s", specPtr->name);
return -1;
}
ob.rowidPtr = specPtr;
}
if (specPtr->flags&JSI_OPT_DB_DIRTY) {
if (specPtr->id == JSI_OPTION_BOOL || specPtr->id == JSI_OPTION_INT) {
ob.dirtyPtr = specPtr;
} else {
Jsi_LogError("dirty flag must be a int/bool field: %s", specPtr->name);
return -1;
}
}
}
}
if (k==0)
ob.optLen = scnt;
assert(specPtr->id == JSI_OPTION_END);
}
if (!dbopts[k].prefix) break;
}
specs = dbopts[0].sf;
int structSize = specs[ob.optLen].size;
if (dbopts->memClear || dbopts->memFree) {
cnt = dbopts[0].arrSize;
void *rec = dbopts[0].data, *prec = rec;
void **recPtrPtr = NULL;
if (dbopts->isPtr2) {
recPtrPtr = (void**)rec; /* This is really a void***, but this gets recast below. */
rec = *recPtrPtr;
}
if (cnt<=0 && rec && dbopts->isPtr2) {
for (cnt=0; ((void**)rec)[cnt]!=NULL; cnt++);
}
for (k=0; k<cnt; k++) {
if (dbopts->isPtr2 || dbopts->isPtrs)
prec = ((void**)rec)[k];
else
prec = (char*)rec + (k * structSize);
if (!prec)
continue;
Jsi_OptionsFree(interp, (Jsi_OptionSpec*)specs, prec, 0);
if (dbopts->isPtr2 || dbopts->isPtrs) {
Jsi_Free(prec);
}
}
if (recPtrPtr) {
Jsi_Free(*recPtrPtr);
*recPtrPtr = NULL;
}
if (query == NULL || query[0] == 0)
return 0;
}
if (!Jsi_Strncasecmp(query, "SELECT", 6))
return dbOptSelect(jdb, query, &ob, dbopts);
DbEvalContext sEval = {};
int insert = 0, replace = 0, update = 0;
char nbuf[100], *bPtr;
#ifdef JSI_DB_DSTRING_SIZE
JSI_DSTRING_VAR(dStr, JSI_DB_DSTRING_SIZE);
#else
Jsi_DString sStr, *dStr = &sStr;
Jsi_DSInit(dStr);
#endif
if (dbopts->noCache)
sEval.nocache = 1;
if (dbEvalInit(interp, &sEval, jdb, NULL, dStr, 0, 0) != JSI_OK)
return -1;
int dataMax = dbopts[0].arrSize;
cnt = 0;
if (dataMax==0)
dataMax = 1;
char ch[2];
ch[0] = dbopts[0].prefix;
ch[1] = 0;
if (!ch[0])
ch[0] = ':';
if ((update=(Jsi_Strncasecmp(query, "UPDATE", 6)==0))) {
Jsi_DSAppendLen(dStr, query, cPtr?(cPtr-query):-1);
if (cPtr) {
Jsi_DSAppend(dStr, " ", NULL);
int cidx = 0;
int killf = (JSI_OPT_DB_IGNORE|JSI_OPT_READ_ONLY|JSI_OPT_INIT_ONLY);
for (specPtr = specs; specPtr->id != JSI_OPTION_END; specPtr++, cidx++) {
if (specPtr == ob.rowidPtr || specPtr == ob.dirtyPtr || (specPtr->flags&killf))
continue;
const char *fname = specPtr->name;
if (ch[0] == '?')
snprintf(bPtr=nbuf, sizeof(nbuf), "%d", cidx+1);
else
bPtr = (char*)specPtr->name;
Jsi_DSAppend(dStr, (cnt?",":""), "[", fname, "]=",
ch, bPtr, NULL);
cnt++;
}
Jsi_DSAppend(dStr, cPtr+3, NULL);
}
} else if ((insert=(Jsi_Strncasecmp(query, "INSERT", 6)==0))
|| (replace=(Jsi_Strncasecmp(query, "REPLACE", 7)==0))) {
Jsi_DSAppendLen(dStr, query, cPtr?(cPtr-query):-1);
if (cPtr) {
Jsi_DSAppend(dStr, " (", NULL);
int killf = JSI_OPT_DB_IGNORE;
if (replace)
killf |= (JSI_OPT_READ_ONLY|JSI_OPT_INIT_ONLY);
for (specPtr = specs; specPtr->id != JSI_OPTION_END; specPtr++) {
if (specPtr == ob.rowidPtr || specPtr == ob.dirtyPtr || specPtr->flags&killf)
continue;
const char *fname = specPtr->name;
Jsi_DSAppend(dStr, (cnt?",":""), "[", fname, "]", NULL);
cnt++;
}
Jsi_DSAppendLen(dStr,") VALUES(", -1);
cnt = 0;
int cidx = 0;
for (specPtr = specs; specPtr->id != JSI_OPTION_END; specPtr++, cidx++) {
if (specPtr == ob.rowidPtr || specPtr == ob.dirtyPtr
|| specPtr->flags&killf)
continue;
if (ch[0] == '?')
snprintf(bPtr=nbuf, sizeof(nbuf), "%d", cidx+1);
else
bPtr = (char*)specPtr->name;
Jsi_DSAppend(dStr, (cnt?",":""), ch, bPtr, NULL);
cnt++;
}
Jsi_DSAppend(dStr,")", cPtr+3, NULL);
}
} else if (!Jsi_Strncasecmp(query, "DELETE", 6)) {
Jsi_DSAppend(dStr, query, NULL);
} else {
Jsi_LogError("unrecognized query \"%s\": expected one of: SELECT, UPDATE, INSERT, REPLACE or DELETE", query);
return -1;
}
sEval.zSql = Jsi_DSValue(dStr);
if (jdb->echo && sEval.zSql)
Jsi_LogInfo("SQL-ECHO: %s\n", sEval.zSql);
int rc, bindMax = -1, dataIdx = 0;
cnt = 0;
int ismodify = (replace||insert||update);
int isnew = (replace||insert);
int didBegin = 0;
DbEvalContext *p = &sEval;
rc = dbPrepareStmt(p->jdb, p->zSql, &p->zSql, &p->pPreStmt);
if( rc!=JSI_OK ) return -1;
if (dataMax>1 && !dbopts->noBegin) {
didBegin = 1;
if (!dbExecCmd(jdb, JSI_DBQUERY_BEGIN_STR, &erc))
goto bail;
}
while (dataIdx<dataMax) {
if (ismodify && ob.dirtyPtr && (dbopts->dirtyOnly)) { /* Check to limit updates to dirty values only. */
void *rec = dbopts[0].data;
if (dbopts->isPtrs || dbopts->isPtr2)
rec = ((void**)rec)[dataIdx];
else
rec = (char*)rec + (dataIdx * structSize);
char *ptr = (char*)rec + ob.dirtyPtr->offset;
int isDirty = *(int*)ptr;
int bit = 0;
if (ob.dirtyPtr->id == JSI_OPTION_BOOL)
bit = (uintptr_t)ob.dirtyPtr->data;
if (!(isDirty&(1<<(bit)))) {
dataIdx++;
continue;
}
isDirty &= ~(1<<(bit));
*(int*)ptr = isDirty; /* Note that the dirty bit is cleared, even upon error.*/
}
rc = dbBindOptionStmt(jdb, p->pPreStmt->pStmt, &ob, dataIdx, bindMax, dbopts);
if( rc!=JSI_OK )
goto bail;
bindMax = 1;
rc = dbEvalStepSub(p, (dataIdx>=dataMax), &erc);
if (rc == JSI_ERROR)
goto bail;
cnt += sqlite3_changes(jdb->db);
if (rc != JSI_OK && rc != JSI_BREAK)
break;
if (ob.rowidPtr && isnew) {
void *rec = dbopts[0].data;
if (dbopts->isPtrs || dbopts->isPtr2)
rec = ((void**)rec)[dataIdx];
else
rec = (char*)rec + (dataIdx * structSize);
char *ptr = (char*)rec + ob.rowidPtr->offset;
*(Jsi_Wide*)ptr = sqlite3_last_insert_rowid(jdb->db);
}
dataIdx++;
}
if (didBegin && !dbExecCmd(jdb, JSI_DBQUERY_COMMIT_STR, &erc))
rc = JSI_ERROR;
dbEvalFinalize(&sEval);
if( rc==JSI_BREAK ) {
rc = JSI_OK;
}
return (rc==JSI_OK?cnt:erc);
bail:
dbEvalFinalize(&sEval);
if (didBegin)
dbExecCmd(jdb, JSI_DBQUERY_ROLLBACK_STR, NULL);
return erc;
} | 1939 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | StringReplaceCmd | StringReplaceCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC StringReplaceCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
/* Now handles perl regex flag extensions.*/
const char *source_str;
int source_len, bLen;
const char *replace_str = NULL;
int replace_len;
int regexec_flags = 0;
Jsi_Value *seq, *strVal;
Jsi_DString dStr = {};
regex_t *regex;
Jsi_Regex *re;
const char *p;
int maxArgs = 1;
int offset = 0, n, j, isglob = 0, num_matches = 0;
/* Is a generic String.replace if _this->d.obj is a function */
ChkString(_this, funcPtr, source_str, &source_len, &bLen);
source_len = bLen;
if (!skip)
strVal = _this;
else
strVal = Jsi_ValueArrayIndex(interp, args, 0);
seq = Jsi_ValueArrayIndex(interp, args, skip);
Jsi_Value *repVal = Jsi_ValueArrayIndex(interp, args, 1+skip);
if (!Jsi_ValueIsFunction(interp, repVal))
replace_str = Jsi_ValueToString(interp, repVal, &replace_len);
else
maxArgs = repVal->d.obj->d.fobj->func->argnames->argCnt;
Jsi_DSInit(&dStr);
if (Jsi_ValueIsString(interp, seq)) {
const char *ce, *cp = Jsi_ValueString(interp, seq, NULL);
if (!(ce = Jsi_Strstr(source_str, cp)))
Jsi_ValueMakeStringDup(interp, ret, source_str);
else {
int slen;
slen = (ce-source_str);
if (slen)
Jsi_DSAppendLen(&dStr, source_str, slen);
if (replace_str)
Jsi_DSAppendLen(&dStr, replace_str, replace_len);
else {
Jsi_Value *inStr = Jsi_ValueNewStringDup(interp, source_str);
Jsi_IncrRefCount(interp, inStr);
Jsi_RC rc = Jsi_FunctionInvokeString(interp, repVal, inStr, &dStr);
if (Jsi_InterpGone(interp))
return JSI_ERROR;
if (rc != JSI_OK) {
Jsi_DSFree(&dStr);
Jsi_DecrRefCount(interp, inStr);
return JSI_ERROR;
}
Jsi_DecrRefCount(interp, inStr);
}
Jsi_DSAppend(&dStr, ce+Jsi_Strlen(cp), NULL);
Jsi_ValueFromDS(interp, &dStr, ret);
}
return JSI_OK;
}
if (seq == NULL || seq->vt != JSI_VT_OBJECT || seq->d.obj->ot != JSI_OT_REGEXP) {
Jsi_ValueMakeNull(interp, ret);
return JSI_OK;
}
re = seq->d.obj->d.robj;
regex = &re->reg;
isglob = (re->eflags & JSI_REG_GLOB);
regmatch_t pmatch[MAX_SUBREGEX] = {};
/* If an offset has been specified, adjust for that now.
* If it points past the end of the string, point to the terminating null
*/
int eoffset=0;
if (offset) {
if (offset < 0) {
offset += source_len + 1;
}
if (offset > source_len) {
offset = source_len;
}
else if (offset < 0) {
offset = 0;
}
}
Jsi_DSAppendLen(&dStr, source_str, offset);
n = source_len - offset;
p = source_str + offset;
Jsi_RC rc = JSI_OK;
do {
if (num_matches > 10000000) {
Jsi_LogBug("regexp infinite loop");
rc = JSI_ERROR;
break;
}
int match = regexec(regex, p, MAX_SUBREGEX, pmatch, regexec_flags);
if (match >= REG_BADPAT) {
char buf[100];
regerror(match, regex, buf, sizeof(buf));
Jsi_LogError("error while matching pattern: %s", buf);
Jsi_DSFree(&dStr);
return JSI_ERROR;
}
if (match == REG_NOMATCH) {
break;
}
num_matches++;
Jsi_DSAppendLen(&dStr, p, pmatch[0].rm_so);
if (replace_str && !Jsi_Strchr(replace_str, '$'))
Jsi_DSAppend(&dStr, replace_str, NULL);
else if (replace_str) {
for (j = 0; j < replace_len; j++) {
int idx;
int c = replace_str[j];
if (c == '$' && j < replace_len) {
c = replace_str[++j];
if ((c >= '0') && (c <= '9')) {
idx = c - '0';
} else if (c == '&') {
idx = 0;
} else if (c == '$') {
Jsi_DSAppendLen(&dStr, replace_str + j, 1);
continue;
}
else if (c == '\'') {
Jsi_DSAppendLen(&dStr, p + pmatch[0].rm_eo, pmatch[0].rm_eo-Jsi_Strlen(p));
continue;
}
else if (c == '`') {
Jsi_DSAppendLen(&dStr, p, pmatch[0].rm_so);
continue;
}
else {
Jsi_DSAppendLen(&dStr, replace_str + j - 1, 2);
continue;
}
} else {
Jsi_DSAppendLen(&dStr, replace_str + j, 1);
continue;
}
if ((idx < MAX_SUBREGEX) && pmatch[idx].rm_so != -1 && pmatch[idx].rm_eo != -1) {
Jsi_DSAppendLen(&dStr, p + pmatch[idx].rm_so,
pmatch[idx].rm_eo - pmatch[idx].rm_so);
}
}
} else {
Jsi_DString sStr;
Jsi_DSInit(&sStr);
if (pmatch[0].rm_so <= 0 && pmatch[0].rm_eo <= 0)
break;
int olen = -1;
char *ostr = jsi_SubstrDup(p, -1, pmatch[0].rm_so, pmatch[0].rm_eo - pmatch[0].rm_so, &olen);
Jsi_Value *inStr = Jsi_ValueMakeBlob(interp, NULL, (uchar*)ostr, olen);
Jsi_DSFree(&sStr);
Jsi_IncrRefCount(interp, inStr);
if (maxArgs==1) {
Jsi_RC rc = Jsi_FunctionInvokeString(interp, repVal, inStr, &dStr);
if (Jsi_InterpGone(interp))
return JSI_ERROR;
if (rc != JSI_OK) {
Jsi_DSFree(&dStr);
Jsi_DecrRefCount(interp, inStr);
return JSI_ERROR;
}
} else {
Jsi_Value *vpargs, *items[MAX_SUBREGEX] = {}, *ret;
int i;
items[0] = inStr;
for (i=1; i<=(int)re->reg.re_nsub && i<(MAX_SUBREGEX-3); i++) {
if (pmatch[i].rm_so<0)
items[i] = interp->NullValue;
else {
ostr = jsi_SubstrDup(p, -1, pmatch[i].rm_so, pmatch[i].rm_eo - pmatch[i].rm_so, &olen);
items[i] = Jsi_ValueMakeBlob(interp, NULL, (uchar*)ostr, olen);
}
}
items[i++] = Jsi_ValueMakeNumber(interp, NULL, eoffset+pmatch[0].rm_so);
items[i++] = strVal;
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, items, i, 0));
Jsi_IncrRefCount(interp, vpargs);
ret = Jsi_ValueNew1(interp);
rc = Jsi_FunctionInvoke(interp, repVal, vpargs, &ret, NULL);
if (Jsi_InterpGone(interp))
return JSI_ERROR;
Jsi_DecrRefCount(interp, vpargs);
if (rc == JSI_OK)
Jsi_DSAppend(&dStr, Jsi_ValueToString(interp, ret, NULL), NULL);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK) {
Jsi_DSFree(&dStr);
Jsi_DecrRefCount(interp, inStr);
return JSI_ERROR;
}
}
Jsi_DecrRefCount(interp, inStr);
}
eoffset += pmatch[0].rm_eo;
p += pmatch[0].rm_eo;
n -= pmatch[0].rm_eo;
/* If -all is not specified, or there is no source left, we are done */
if (!isglob || n == 0 || pmatch[0].rm_eo == 0) {
break;
}
/* An anchored pattern without -line must be done */
if ((re->eflags & JSI_REG_NEWLINE) == 0 && re->pattern[0] == '^') {
break;
}
/* If the pattern is empty, need to step forwards */
if (re->pattern[0] == '\0' && n) {
/* Need to copy the char we are moving over */
Jsi_DSAppendLen(&dStr, p, 1);
p++;
n--;
}
regexec_flags |= REG_NOTBOL;
} while (n);
/*
* Copy the portion of the string after the last match to the
* result variable.
*/
Jsi_DSAppend(&dStr, p, NULL);
Jsi_ValueFromDS(interp, &dStr, ret);
return rc;
} | 1555 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | StringSearchCmd | StringSearchCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC StringSearchCmd(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);
char *v = _this->d.obj->d.s.str;
Jsi_Value *seq = Jsi_ValueArrayIndex(interp, args, skip);
if (Jsi_ValueIsString(interp, seq)) {
char *ce, *cp = Jsi_ValueString(interp, seq, NULL);
int n = -1;
if ((ce = Jsi_Strstr(source_str, cp))) {
n = (ce-source_str);
}
Jsi_ValueMakeNumber(interp, ret, n);
return JSI_OK;
}
if (!seq || seq->vt != JSI_VT_OBJECT || seq->d.obj->ot != JSI_OT_REGEXP) {
Jsi_ValueMakeNumber(interp, ret, -1);
return JSI_OK;
}
regex_t *reg = &seq->d.obj->d.robj->reg;
regmatch_t pos[MAX_SUBREGEX] = {};
int r;
if ((r = regexec(reg, v, MAX_SUBREGEX, pos, 0)) != 0) {
if (r == REG_NOMATCH) {
Jsi_ValueMakeNumber(interp, ret, -1.0);
return JSI_OK;
}
if (r >= REG_BADPAT) {
char buf[100];
regerror(r, reg, buf, sizeof(buf));
Jsi_LogError("error while matching pattern: %s", buf);
return JSI_ERROR;
}
}
Jsi_ValueMakeNumber(interp, ret, (Jsi_Number)pos[0].rm_so);
return JSI_OK;
} | 315 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | TreeTest | TreeTest( Jsi_Interp * interp) | ['interp'] | static void TreeTest(Jsi_Interp* interp) {
Jsi_Tree *st, *wt, *mt;
Jsi_TreeEntry *hPtr, *hPtr2;
bool isNew, i;
Jsi_TreeSearch srch;
struct tdata {
int n;
int m;
} t1, t2;
char nbuf[100];
wt = Jsi_TreeNew(interp, JSI_KEYS_ONEWORD, NULL);
mt = Jsi_TreeNew(interp, sizeof(struct tdata), NULL);
Jsi_TreeSet(wt, wt,(void*)0x88);
Jsi_TreeSet(wt, mt,(void*)0x99);
printf("WT: %p\n", Jsi_TreeGet(wt, mt));
printf("WT2: %p\n", Jsi_TreeGet(wt, wt));
Jsi_TreeDelete(wt);
t1.n = 0; t1.m = 1;
t2.n = 1; t2.m = 2;
Jsi_TreeSet(mt, &t1,(void*)0x88);
Jsi_TreeSet(mt, &t2,(void*)0x99);
Jsi_TreeSet(mt, &t2,(void*)0x98);
printf("CT: %p\n", Jsi_TreeGet(mt, &t1));
printf("CT2: %p\n", Jsi_TreeGet(mt, &t2));
Jsi_TreeDelete(mt);
st = Jsi_TreeNew(interp, JSI_KEYS_STRING, NULL);
hPtr = Jsi_TreeEntryNew(st, "bob", &isNew);
Jsi_TreeValueSet(hPtr, (void*)99);
Jsi_TreeSet(st, "zoe",(void*)77);
hPtr2 = Jsi_TreeSet(st, "ted",(void*)55);
Jsi_TreeSet(st, "philip",(void*)66);
Jsi_TreeSet(st, "alice",(void*)77);
puts("SRCH");
for (hPtr=Jsi_TreeSearchFirst(st,&srch, JSI_TREE_ORDER_IN, NULL); hPtr; hPtr=Jsi_TreeSearchNext(&srch))
mycall(st, hPtr, NULL);
Jsi_TreeSearchDone(&srch);
puts("IN");
Jsi_TreeWalk(st, mycall, NULL, JSI_TREE_ORDER_IN);
puts("PRE");
Jsi_TreeWalk(st, mycall, NULL, JSI_TREE_ORDER_PRE);
puts("POST");
Jsi_TreeWalk(st, mycall, NULL, JSI_TREE_ORDER_POST);
puts("LEVEL");
Jsi_TreeWalk(st, mycall, NULL, JSI_TREE_ORDER_LEVEL);
Jsi_TreeEntryDelete(hPtr2);
puts("INDEL");
Jsi_TreeWalk(st, mycall, NULL, 0);
for (i=0; i<1000; i++) {
snprintf(nbuf, sizeof(nbuf), "name%d", i);
Jsi_TreeSet(st, nbuf,(void*)i);
}
Jsi_TreeWalk(st, mycall, NULL, 0);
for (i=0; i<1000; i++) {
Jsi_TreeEntryDelete(st->root);
}
puts("OK");
Jsi_TreeWalk(st, mycall, NULL, 0);
Jsi_TreeDelete(st);
} | 546 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_treeFmtKey | jsi_treeFmtKey( Jsi_MapEntry * h , struct Jsi_MapOpts * opts , int flags) | ['h', 'opts', 'flags'] | static Jsi_Value *jsi_treeFmtKey(Jsi_MapEntry* h, struct Jsi_MapOpts *opts, int flags)
{
Jsi_TreeEntry* hPtr = (Jsi_TreeEntry*)h;
void *key = Jsi_TreeKeyGet(hPtr);
if (opts->keyType == JSI_KEYS_ONEWORD)
return Jsi_ValueNewNumber(opts->interp, (Jsi_Number)(intptr_t)key);
char nbuf[100];
snprintf(nbuf, sizeof(nbuf), "%p", key);
return Jsi_ValueNewStringDup(opts->interp, nbuf);
} | 89 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsiLNGetMatches | jsiLNGetMatches( const char * str , linenoiseCompletions * lc) | ['str', 'lc'] | static void jsiLNGetMatches(const char *str, linenoiseCompletions *lc) {
char buf[1000], pre[1000], hpre[6] = {};
const char *cp, *fnam = "Info.completions";
int i = 0, len;
int rc, isfile = 0, start = 0, end = Jsi_Strlen(str);
Jsi_Interp* interp = jsi_interactiveInterp;
if (!Jsi_Strncmp(str, "help ", 5)) {
Jsi_Strcpy(hpre, "help ");
str += 5;
end -= 5;
}
if (end<=0) return;
Jsi_Strncpy(buf, str, sizeof(buf)-1);
buf[sizeof(buf)-1] = 0;
pre[0] = 0;
if (end<=3 && !Jsi_Strncmp(str, "help", end)) {
linenoiseAddCompletion(lc, "help");
return;
}
if (!completeValues)
completeValues = Jsi_ValueNew1(interp);
Jsi_Value *func = interp->onComplete;
if (func == NULL || !Jsi_ValueIsFunction(interp, func)) {
for (i=0; jsiFilePreCmds[i]; i++)
if (!Jsi_Strncmp(buf, jsiFilePreCmds[i], Jsi_Strlen(jsiFilePreCmds[i]))) break;
if (jsiFilePreCmds[i] && ((cp=Jsi_Strrchr(buf, '(')) && (cp[1]=='\"' || cp[1]=='\''))) {
Jsi_Strcpy(pre, buf);
pre[cp-buf+2] = 0;
snprintf(buf, sizeof(buf), "%s*%s", cp+2, (buf[0]=='s'?".js*":""));
isfile = 1;
fnam = "File.glob";
}
}
func = Jsi_NameLookup(interp, fnam);
if (func && Jsi_ValueIsFunction(interp, func)) {
//printf("PATTERN: %s\n", str);
Jsi_Value *items[3] = {};;
i = 0;
items[i++] = Jsi_ValueNewStringDup(interp, buf);
if (!isfile) {
items[i++] = Jsi_ValueNewNumber(interp, (Jsi_Number)start);
items[i++] = Jsi_ValueNewNumber(interp, (Jsi_Number)end);
}
Jsi_Value *args = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, items, i, 0));
Jsi_IncrRefCount(interp, args);
rc = Jsi_FunctionInvoke(interp, func, args, &completeValues, interp->csc);
Jsi_DecrRefCount(interp, args);
if (rc != JSI_OK) {
fprintf(stderr, "bad completion: %s %d %d\n", str?str:"", start, end);
return;
}
const char *name;
Jsi_Interp* interp = jsi_interactiveInterp;
if (completeValues == NULL || !Jsi_ValueIsArray(interp, completeValues))
return;
Jsi_Value **arr = completeValues->d.obj->arr;
int aLen = completeValues->d.obj->arrCnt;
i = 0;
while (i<aLen)
{
name = Jsi_ValueString(interp, arr[i], &len);
if (name) {
if (!pre[0] && !hpre[0])
linenoiseAddCompletion(lc, name);
else {
snprintf(buf, sizeof(buf), "%s%s%s", hpre, pre, name);
linenoiseAddCompletion(lc, buf);
}
}
i++;
}
}
} | 641 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsiValueGetString | jsiValueGetString( Jsi_Interp * interp , Jsi_Value * v , Jsi_DString * dStr , objwalker * owPtr) | ['interp', 'v', 'dStr', 'owPtr'] | static Jsi_RC jsiValueGetString(Jsi_Interp *interp, Jsi_Value* v, Jsi_DString *dStr, objwalker *owPtr)
{
char buf[100], *str;
Jsi_DString eStr;
Jsi_DSInit(&eStr);
if (interp->maxDepth>0 && owPtr->depth > interp->maxDepth)
return Jsi_LogError("recursive ToString");
int quote = owPtr->quote;
int isjson = owPtr->quote&JSI_OUTPUT_JSON;
Jsi_Number num;
switch(v->vt) {
case JSI_VT_UNDEF:
Jsi_DSAppend(dStr, "undefined", NULL);
return JSI_OK;
case JSI_VT_NULL:
Jsi_DSAppend(dStr, "null", NULL);
return JSI_OK;
case JSI_VT_VARIABLE:
Jsi_DSAppend(dStr, "variable", NULL);
return JSI_OK;
case JSI_VT_BOOL:
Jsi_DSAppend(dStr, (v->d.val ? "true":"false"), NULL);
return JSI_OK;
case JSI_VT_NUMBER:
num = v->d.num;
outnum:
if (isjson && !Jsi_NumberIsNormal(num)) {
Jsi_DSAppend(dStr, "null", NULL);
} else if (Jsi_NumberIsInteger(num)) {
Jsi_NumberItoA10((Jsi_Wide)num, buf, sizeof(buf));
Jsi_DSAppend(dStr, buf, NULL);
} else if (Jsi_NumberIsWide(num)) {
snprintf(buf, sizeof(buf), "%" PRId64, (Jsi_Wide)num);
Jsi_DSAppend(dStr, buf, NULL);
} else if (Jsi_NumberIsNormal(num) || Jsi_NumberIsSubnormal(num)) {
Jsi_NumberDtoA(interp, num, buf, sizeof(buf), 0);
Jsi_DSAppend(dStr, buf, NULL);
} else if (Jsi_NumberIsNaN(num)) {
Jsi_DSAppend(dStr, "NaN", NULL);
} else {
int s = Jsi_NumberIsInfinity(num);
if (s > 0) Jsi_DSAppend(dStr, "+Infinity", NULL);
else if (s < 0) Jsi_DSAppend(dStr, "-Infinity", NULL);
else Jsi_LogBug("Ieee function problem: %d", fpclassify(num));
}
return JSI_OK;
case JSI_VT_STRING:
str = v->d.s.str;
outstr:
if (!quote) {
Jsi_DSAppend(dStr, str, NULL);
return JSI_OK;
}
Jsi_DSAppend(dStr,"\"", NULL);
while (*str) {
if ((*str == '\'' && (!isjson)) || *str == '\\'|| *str == '\"'|| (*str == '\n'
&& (!(owPtr->quote&JSI_OUTPUT_NEWLINES)))
|| *str == '\r' || *str == '\t' || *str == '\f' || *str == '\b' ) {
char pcp[2];
*pcp = *str;
pcp[1] = 0;
Jsi_DSAppendLen(dStr,"\\", 1);
switch (*str) {
case '\r': *pcp = 'r'; break;
case '\n': *pcp = 'n'; break;
case '\t': *pcp = 't'; break;
case '\f': *pcp = 'f'; break;
case '\b': *pcp = 'b'; break;
}
Jsi_DSAppendLen(dStr,pcp, 1);
} else if (isprint(*str) || !isjson)
Jsi_DSAppendLen(dStr,str, 1);
else {
char ubuf[10];
int l = Jsi_UtfEncode(str, ubuf);
Jsi_DSAppend(dStr,ubuf, NULL);
str += l-1;
}
str++;
}
Jsi_DSAppend(dStr,"\"", NULL);
Jsi_DSFree(&eStr);
return JSI_OK;
case JSI_VT_OBJECT: {
Jsi_Obj *o = v->d.obj;
switch(o->ot) {
case JSI_OT_BOOL:
Jsi_DSAppend(dStr, (o->d.val ? "true":"false"), NULL);
return JSI_OK;
case JSI_OT_NUMBER:
num = o->d.num;
goto outnum;
return JSI_OK;
case JSI_OT_STRING:
str = o->d.s.str;
goto outstr;
case JSI_OT_FUNCTION:
Jsi_FuncObjToString(interp, o->d.fobj->func, &eStr, 3 | ((owPtr->depth==0 && owPtr->quote)?8:0));
str = Jsi_DSValue(&eStr);
goto outstr;
case JSI_OT_REGEXP:
str = o->d.robj->pattern;
goto outstr;
case JSI_OT_USEROBJ:
jsi_UserObjToName(interp, o->d.uobj, &eStr);
str = Jsi_DSValue(&eStr);
goto outstr;
case JSI_OT_ITER:
Jsi_DSAppend(dStr, (isjson?"null":"*ITER*"), NULL);
return JSI_OK;
default:
break;
}
if (o->isarrlist)
{
Jsi_Value *nv;
int i, len = o->arrCnt;
if (!o->arr)
len = Jsi_ValueGetLength(interp, v);
Jsi_DSAppend(dStr,"[",len?" ":"", NULL);
for (i = 0; i < len; ++i) {
nv = Jsi_ValueArrayIndex(interp, v, i);
if (i) Jsi_DSAppend(dStr,", ", NULL);
owPtr->depth++;
if (nv) {
if (jsiValueGetString(interp, nv, dStr, owPtr) != JSI_OK) {
owPtr->depth--;
return JSI_ERROR;
}
}
else Jsi_DSAppend(dStr, "undefined", NULL);
owPtr->depth--;
}
Jsi_DSAppend(dStr,len?" ":"","]", NULL);
} else {
int len = Jsi_TreeSize(o->tree);
Jsi_DSAppend(dStr,"{",len?" ":"", NULL);
owPtr->depth++;
Jsi_TreeWalk(o->tree, _object_get_callback, owPtr, 0);
owPtr->depth--;
Jsi_DSAppend(dStr,len?" ":"","}", NULL);
}
return JSI_OK;
}
#ifndef __cplusplus
default:
Jsi_LogBug("Unexpected value type: %d", v->vt);
#endif
}
return JSI_OK;
} | 1101 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | Jsi_ValueArrayIndex | Jsi_ValueArrayIndex( Jsi_Interp * interp , Jsi_Value * args , int index) | ['interp', 'args', 'index'] | Jsi_Value *Jsi_ValueArrayIndex(Jsi_Interp *interp, Jsi_Value *args, int index)
{
Jsi_Obj *obj = args->d.obj;
Jsi_Value *v;
assert(args->vt == JSI_VT_OBJECT);
if (obj->isarrlist && obj->arr)
return ((index < 0 || (uint)index >= obj->arrCnt) ? NULL : obj->arr[index]);
char unibuf[100];
Jsi_NumberItoA10(index, unibuf, sizeof(unibuf));
v = Jsi_TreeObjGetValue(args->d.obj, unibuf, 0);
return v;
} | 111 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | Jsi_ValueInsertArray | Jsi_ValueInsertArray( Jsi_Interp * interp , Jsi_Value * target , int key , Jsi_Value * val , int flags) | ['interp', 'target', 'key', 'val', 'flags'] | Jsi_RC Jsi_ValueInsertArray(Jsi_Interp *interp, Jsi_Value *target, int key, Jsi_Value *val, int flags)
{
if (target->vt != JSI_VT_OBJECT) {
if (interp->strict)
Jsi_LogWarn("Target is not object");
return JSI_ERROR;
}
Jsi_Obj *obj = target->d.obj;
if (obj->isarrlist) {
if (key >= 0 && key < interp->maxArrayList) {
Jsi_ObjArraySet(interp, obj, val, key);
return JSI_OK;
}
return JSI_ERROR;
}
char unibuf[100];
Jsi_NumberItoA10(key, unibuf, sizeof(unibuf));
Jsi_ObjInsert(interp, obj, unibuf, val, flags);
return JSI_OK;
} | 129 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | Jsi_ValueToString | Jsi_ValueToString( Jsi_Interp * interp , Jsi_Value * v , int * lenPtr) | ['interp', 'v', 'lenPtr'] | const char* Jsi_ValueToString(Jsi_Interp *interp, Jsi_Value *v, int *lenPtr)
{
Jsi_Number d;
const char *ntxt = "undefined";
int kflag = 1;
int isKey = 0;
char *key = NULL;
if (!v)
goto done;
if (lenPtr) *lenPtr = 0;
char unibuf[200];
switch(v->vt) {
case JSI_VT_STRING:
ntxt = v->d.s.str;
goto done;
case JSI_VT_UNDEF:
break;
case JSI_VT_BOOL:
ntxt = v->d.val ? "true":"false";
break;
case JSI_VT_NULL:
ntxt = "null";
break;
case JSI_VT_NUMBER: {
d = v->d.num;
fmtnum:
if (Jsi_NumberIsInteger(d)) {
Jsi_NumberItoA10((Jsi_Wide)d, unibuf, sizeof(unibuf));
kflag = 0;
ntxt = unibuf;
} else if (Jsi_NumberIsNormal(d)) {
Jsi_NumberDtoA(interp, d, unibuf, sizeof(unibuf), 0);
kflag = 0;
ntxt = unibuf;
} else if (Jsi_NumberIsNaN(v->d.num)) {
ntxt = "NaN";
} else {
int s = Jsi_NumberIsInfinity(d);
if (s > 0) ntxt = "Infinity";
else if (s < 0) ntxt = "-Infinity";
else Jsi_LogBug("Ieee function got problem");
}
break;
}
case JSI_VT_OBJECT: {
Jsi_Obj *obj = v->d.obj;
switch(obj->ot) {
case JSI_OT_STRING:
ntxt = obj->d.s.str;
goto done;
case JSI_OT_BOOL:
ntxt = obj->d.val ? "true":"false";
break;
case JSI_OT_NUMBER:
d = obj->d.num;
goto fmtnum;
break;
default:
ntxt = "[object Object]";
break;
}
break;
}
default:
Jsi_LogBug("Convert a unknown type: 0x%x to string", v->vt);
break;
}
Jsi_ValueReset(interp, &v);
if (!kflag) {
Jsi_ValueMakeStringDup(interp, &v, ntxt);
return Jsi_ValueString(interp, v, lenPtr);
}
key = jsi_KeyFind(interp, ntxt, 0, &isKey);
if (key)
Jsi_ValueMakeStringKey(interp, &v, key);
else
Jsi_ValueMakeString(interp, &v, ntxt);
ntxt = v->d.s.str;
done:
if (lenPtr) *lenPtr = Jsi_Strlen(ntxt);
return ntxt;
} | 455 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ValueSubscript | jsi_ValueSubscript( Jsi_Interp * interp , Jsi_Value * target , Jsi_Value * key , Jsi_Value ** ret) | ['interp', 'target', 'key', 'ret'] | 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[100];
snprintf(fbuf, sizeof(fbuf), "Function.%s", kstr);
Jsi_Value *vv = Jsi_NameLookup(interp, fbuf);
if (vv)
return vv;
}
}
}
}
return NULL;
} | 842 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | WebSocketVersionCmd | WebSocketVersionCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC WebSocketVersionCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
const char *verStr = NULL;
verStr = lws_get_library_version();
if (verStr) {
char buf[100], *cp;
snprintf(buf, sizeof(buf), "%s", verStr);
cp = Jsi_Strchr(buf, ' ');
if (cp) *cp = 0;
Jsi_ValueMakeStringDup(interp, ret, buf);
}
return JSI_OK;
} | 96 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_wsGetHeaders | jsi_wsGetHeaders( jsi_wsPss * pss , struct lws * wsi , Jsi_DString * dStr , int lens [ ] , int hmax) | ['pss', 'wsi', 'dStr', 'hmax'] | jsi_wsGetHeaders(jsi_wsPss *pss, struct lws *wsi, Jsi_DString* dStr, int lens[], int hmax)
{
int n = 0, i = 0, nlen;
char buf[1000];
const char *cp;
while ((cp = (char*)lws_token_to_string((enum lws_token_indexes)n))) {
int len = lws_hdr_copy(wsi, buf, sizeof(buf), ( enum lws_token_indexes)n);
n++;
if (i>=(n*2+2)) break;
if (len<=0) continue;
buf[sizeof(buf)-1] = 0;
if (!buf[0]) continue;
nlen = Jsi_Strlen(cp);
if (nlen>0 && cp[nlen-1]==' ') nlen--;
if (nlen>0 && cp[nlen-1]==':') nlen--;
Jsi_DSAppendLen(dStr, cp, nlen);
Jsi_DSAppend(dStr, "=", buf, "\n", NULL);
if (lens) {
lens[i++] = nlen;
lens[i++] = Jsi_Strlen(buf);
}
}
//printf("HEE: %d = %s\n", pss->wid, Jsi_DSValue(dStr) );
return i;
} | 229 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_wsHttp | jsi_wsHttp( Jsi_Interp * interp , jsi_wsCmdObj * cmdPtr , struct lws * wsi , void * user , struct lws_context * context , const char * inPtr , Jsi_DString * tStr , jsi_wsPss * pss) | ['interp', 'cmdPtr', 'wsi', 'user', 'context', 'inPtr', 'tStr', 'pss'] | static int jsi_wsHttp(Jsi_Interp *interp, jsi_wsCmdObj *cmdPtr, struct lws *wsi, void *user,
struct lws_context *context, const char* inPtr, Jsi_DString *tStr, jsi_wsPss *pss)
{
const char *ext = NULL;
unsigned char buffer[JSI_BUFSIZ];
const char *mime = NULL;
time_t now = time(NULL);
char buf[JSI_BUFSIZ];
int rc = 0;
buf[0] = 0;
uchar *p = buffer, *end = &buffer[sizeof(buffer)-1];
int n;
Jsi_Value* fname = NULL;
bool isJsiWeb = 0, isSSI = 0;
cmdPtr->stats.httpLast = now;
/* if a legal POST URL, let it continue and accept data */
if (lws_hdr_total_length(wsi, WSI_TOKEN_POST_URI))
return 0;
if (!pss)
pss = jsi_wsgetPss(cmdPtr, wsi, user, 1, 1);
int uplen=(cmdPtr->urlPrefix?Jsi_Strlen(cmdPtr->urlPrefix):0);
if (inPtr && cmdPtr->urlPrefix && !Jsi_Strncmp(inPtr, cmdPtr->urlPrefix, uplen))
inPtr += uplen;
if (cmdPtr->redirDisable) {// Try to defray redirect loops.
if (difftime(now, cmdPtr->stats.redirLast)>=600)
cmdPtr->redirDisable = 0;
else
cmdPtr->redirDisable--;
}
if ((cmdPtr->urlRedirect && (inPtr == 0 || *inPtr == 0 || !Jsi_Strcmp(inPtr, "/")) && !cmdPtr->redirDisable)
&& (inPtr = cmdPtr->urlRedirect) && inPtr[0]) {
cmdPtr->stats.redirCnt++;
// TODO: system time change can disrupt the following.
if (cmdPtr->redirMax>0 && !cmdPtr->redirDisable && cmdPtr->redirMax>0 && cmdPtr->stats.redirLast
&& difftime(now, cmdPtr->stats.redirLast)<600 && ++cmdPtr->redirAllCnt>cmdPtr->redirMax)
cmdPtr->redirDisable = 100;
cmdPtr->stats.redirLast = now;
rc = lws_http_redirect(wsi, 301, (uchar*)inPtr, Jsi_Strlen(inPtr), &p, end);
return (rc == 100 ? 0 : 1);
}
if (!inPtr || !*inPtr)
inPtr = "/";
if (cmdPtr->useridPass || cmdPtr->onAuth) {
int ok = 0;
int alen;
const char *auth = jsi_wsHeader(pss, "authorization", &alen);
if (auth && !Jsi_Strncasecmp(auth, "basic ", 6) && !cmdPtr->deleted) {
auth += 6;
Jsi_DString eStr = {}, bStr = {};
Jsi_DSAppendLen(&eStr, auth, alen - 6);
Jsi_Base64(Jsi_DSValue(&eStr), -1, &bStr, 1);
const char *bp = Jsi_DSValue(&bStr);
if (bp && bp[0]) {
if (!cmdPtr->onAuth)
ok = (!Jsi_Strcmp(cmdPtr->useridPass, bp));
else {
/* Pass 4 args: ws, id, url and userid:pass . */
Jsi_Obj *oarg1;
Jsi_Value *vpargs, *vargs[10];
int n = 0;
vargs[n++] = Jsi_ValueNewObj(interp, cmdPtr->fobj);
vargs[n++] = Jsi_ValueNewNumber(interp, (Jsi_Number)(pss->wid));
vargs[n++] = Jsi_ValueNewStringDup(interp, inPtr);
vargs[n++] = Jsi_ValueNewStringDup(interp, bp);
vpargs = Jsi_ValueMakeObject(interp, NULL, oarg1 = Jsi_ObjNewArray(interp, vargs, n, 0));
Jsi_IncrRefCount(interp, vpargs);
Jsi_Value *ret = Jsi_ValueNew1(interp);
bool rb = 0;
rc = Jsi_FunctionInvoke(interp, cmdPtr->onAuth, vpargs, &ret, NULL);
if (rc == JSI_OK)
rb = !Jsi_ValueIsFalse(interp, ret);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK) {
Jsi_LogError("websock bad rcv eval");
return -1;
}
ok = rb;
}
}
Jsi_DSFree(&eStr);
Jsi_DSFree(&bStr);
}
if (!ok) {
const char *realm = (cmdPtr->realm?cmdPtr->realm:"jsish");
int n = snprintf(buf, sizeof(buf), "Basic realm=\"%s\"", realm);
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_WWW_AUTHENTICATE,
(unsigned char *)buf, n, &p, end))
return -1;
if (jsi_wsServeString(pss, wsi, "Password is required to access this page", 401, (char*)buffer, NULL)<0)
return -1;
return lws_http_transaction_completed(wsi);
}
}
if (cmdPtr->onGet || pss->onGet) {
Jsi_RC jrc;
int rrv = 1;
if (cmdPtr->getRegexp) {
rrv = 0;
jrc = Jsi_RegExpMatch(interp, cmdPtr->getRegexp, inPtr, &rrv, NULL);
if (jrc != JSI_OK)
return -1; // Error in regexp.
}
if (rrv) {
jrc = jsi_wsGetCmd(interp, cmdPtr, pss, wsi, inPtr, pss->onGet?pss->onGet:cmdPtr->onGet, tStr);
switch (jrc) {
case JSI_ERROR: return -1;
case JSI_OK: return 0;
case JSI_SIGNAL:
return jsi_ws_http_redirect(wsi, 302, tStr, &p, end);
case JSI_CONTINUE:
inPtr = Jsi_DSValue(tStr); break;
case JSI_BREAK: break;
default: break;
}
}
}
ext = Jsi_Strrchr(inPtr, '.');
Jsi_Value *rdir = (pss->rootdir?pss->rootdir:cmdPtr->rootdir);
cmdPtr->curRoot = (rdir?Jsi_ValueString(cmdPtr->interp, rdir, NULL):"./");
Jsi_DString sStr;
Jsi_DSInit(&sStr);
jsi_wsPathAlias(interp, cmdPtr, &inPtr, &sStr);
snprintf(buf, sizeof(buf), "%s/%s", cmdPtr->curRoot, inPtr);
Jsi_DSFree(&sStr);
if (cmdPtr->debug>1)
fprintf(stderr, "FILE: %s in %s | %s\n", buf, cmdPtr->curRoot, Jsi_ValueString(interp, cmdPtr->rootdir, NULL));
char extBuf[100], *cpde = Jsi_Strrchr(buf, '/');
isJsiWeb = (cpde && cmdPtr->jsiFnPattern && Jsi_GlobMatch(cmdPtr->jsiFnPattern, cpde+1, 0));
bool isgzip = 0;
if (!ext || !ext[1])
mime = "text/html";
else {
const char *eext = ext+1;
uint elen = Jsi_Strlen(ext);
if (elen>3 && elen<(sizeof(extBuf)-10) && !Jsi_Strcmp(ext+elen-3,".gz")) {
Jsi_Strcpy(extBuf, ext);
extBuf[elen-3] = 0;
char *ext2 = Jsi_Strrchr(extBuf, '.');
if (ext2) {
isgzip = 1;
ext = ext2;
}
}
Jsi_HashEntry *hPtr;
if (cmdPtr->mimeTypes) {
/* Lookup mime type in mimeTypes object. */
Jsi_Value *mVal = Jsi_ValueObjLookup(interp, cmdPtr->mimeTypes, ext+1, 1);
if (mVal)
mime = Jsi_ValueString(interp, mVal, NULL);
}
if (!mime) {
static const char* mtypes[] = {
"html", "text/html", "js", "application/x-javascript",
"css", "text/css", "png", "image/png", "ico", "image/icon",
"gif", "image/gif", "jpeg", "image/jpeg",
"jpg", "image/jpeg", "svg", "image/svg+xml",
"json", "application/json", "txt", "text/plain",
"jsi", "application/x-javascript", "cssi", "text/css",
"shtml", "text/html", "scss", "text/css",
"sjs", "application/x-javascript",
0, 0
};
mime = "text/html";
int i;
for (i=0; mtypes[i]; i+=2)
if (tolower(*eext) == mtypes[i][0] && !Jsi_Strncasecmp(eext, mtypes[i], -1)) {
mime = mtypes[i+1];
break;
}
}
isSSI = jsi_wsIsSSIExt(interp, cmdPtr, pss, eext);
if ((hPtr = Jsi_HashEntryFind(cmdPtr->handlers, ext)) && !cmdPtr->deleted) {
/* Use interprete html eg. using jsi_wpp preprocessor */
Jsi_DString jStr = {};
Jsi_Value *vrc = NULL;
int hrc = 0, strLen, evrc, isalloc=0;
char *vStr, *hstr = NULL;
jsi_wsHander *hdlPtr = (jsi_wsHander*)Jsi_HashValueGet(hPtr);
Jsi_Value *hv = hdlPtr->val;
if (Jsi_Strchr(buf, '\'') || Jsi_Strchr(buf, '\"')) {
jsi_wsServeString(pss, wsi, "Can not handle quotes in url", 404, NULL, NULL);
return -1;
}
cmdPtr->handlersPkg=1;
// Attempt to load package and get function.
if ((hdlPtr->flags&1) && cmdPtr->handlersPkg && Jsi_ValueIsString(interp, hv)
&& ((hstr = Jsi_ValueString(interp, hv, NULL)))) {
vrc = Jsi_NameLookup(interp, hstr);
if (!vrc) {
Jsi_Number pver = Jsi_PkgRequire(interp, hstr, 0);
if (pver >= 0)
vrc = Jsi_NameLookup(interp, hstr);
}
if (!vrc || !Jsi_ValueIsFunction(interp, vrc)) {
if (vrc)
Jsi_DecrRefCount(interp, vrc);
Jsi_LogError("Failed to autoload handle: %s", hstr);
jsi_wsServeString(pss, wsi, "Failed to autoload handler", 404, NULL, NULL);
return -1;
}
if (hdlPtr->val)
Jsi_DecrRefCount(interp, hdlPtr->val);
hdlPtr->val = vrc;
Jsi_IncrRefCount(interp, vrc);
hv = vrc;
}
if ((hdlPtr->flags&2) && !hdlPtr->triedLoad && !hdlPtr->objVar && Jsi_ValueIsFunction(interp, hv)) {
// Run command and from returned object get the parse function.
hdlPtr->triedLoad = 1;
Jsi_DSAppend(&jStr, "[null]", NULL);
Jsi_DSAppend(&jStr, "]", NULL);
vrc = Jsi_ValueNew1(interp);
evrc = Jsi_FunctionInvokeJSON(interp, hv, Jsi_DSValue(&jStr), &vrc);
if (Jsi_InterpGone(interp))
return -1;
if (evrc != JSI_OK || !vrc || !Jsi_ValueIsObjType(interp, vrc, JSI_OT_OBJECT)) {
Jsi_LogError("Failed to load obj: %s", hstr);
jsi_wsServeString(pss, wsi, "Failed to load obj", 404, NULL, NULL);
return -1;
}
Jsi_Value *fvrc = Jsi_ValueObjLookup(interp, vrc, "parse", 0);
if (!fvrc || !Jsi_ValueIsFunction(interp, fvrc)) {
Jsi_LogError("Failed to find parse: %s", hstr);
jsi_wsServeString(pss, wsi, "Failed to find parse", 404, NULL, NULL);
return -1;
}
hdlPtr->objVar = fvrc;
Jsi_IncrRefCount(interp, fvrc);
hv = vrc;
}
if (hdlPtr->objVar) { // Call the obj.parse function.
Jsi_DSAppend(&jStr, "[\"", buf, "\"]", NULL); // TODO: JSON encode.
vrc = Jsi_ValueNew1(interp);
evrc = Jsi_FunctionInvokeJSON(interp, hdlPtr->objVar, Jsi_DSValue(&jStr), &vrc);
isalloc = 1;
}
else if (Jsi_ValueIsFunction(interp, hv)) {
//printf("CNCNN: %s\n", Jsi_DSValue(&cmdPtr->cName));
Jsi_DSAppend(&jStr, "[\"", buf, "\", {wsName:\"", Jsi_DSValue(&cmdPtr->cName), "\"", "}]", NULL); // TODO: JSON encode.
vrc = Jsi_ValueNew1(interp);
evrc = Jsi_FunctionInvokeJSON(interp, hv, Jsi_DSValue(&jStr), &vrc);
isalloc = 1;
} else {
// One shot invoke of string command.
hstr = Jsi_ValueString(interp, hv, NULL);
Jsi_DSAppend(&jStr, hstr, "('", buf, "');", NULL);
evrc = Jsi_EvalString(interp, Jsi_DSValue(&jStr), JSI_EVAL_RETURN);
if (evrc == JSI_OK)
vrc = Jsi_InterpResult(interp);
}
// Take result from vrc and return it.
if (evrc != JSI_OK) {
Jsi_LogError("failure in websocket handler");
} else if ((!vrc) ||
(!(vStr = Jsi_ValueString(interp, vrc, &strLen)))) {
Jsi_LogError("failed to get result");
} else {
hrc = jsi_wsServeString(pss, wsi, vStr, 0, NULL, mime);
}
Jsi_DSFree(&jStr);
if (isalloc)
Jsi_DecrRefCount(interp, vrc);
if (hrc<=0)
return -1;
return 1;
}
}
if (!buf[0]) {
if (cmdPtr->debug)
fprintf(stderr, "empty file: %s\n", inPtr);
return -1;
}
fname = Jsi_ValueNewStringDup(interp, buf);
Jsi_IncrRefCount(interp, fname);
Jsi_DString hStr = {};
Jsi_StatBuf jsb;
bool native = Jsi_FSNative(interp, fname);
if ((native && Jsi_InterpSafe(interp) && Jsi_InterpAccess(interp, fname, JSI_INTACCESS_READ) != JSI_OK) ||
(Jsi_Stat(interp, fname, &jsb) || jsb.st_size<=0)) {
nofile:
if (cmdPtr->onUnknown || pss->onUnknown) {
Jsi_Value *uk = (pss->onUnknown?pss->onUnknown:cmdPtr->onUnknown);
Jsi_RC jrc = jsi_wsGetCmd(interp, cmdPtr, pss, wsi, inPtr, uk, NULL);
if (jrc == JSI_ERROR)
goto bail;
if (jrc == JSI_OK)
goto done;
}
if (0 && Jsi_Strstr(buf, "favicon.ico"))
rc = jsi_wsServeString(pss, wsi, "data:;base64,iVBORw0KGgo=", 200, NULL, "image/icon");
else {
const char *cp = Jsi_Strrchr(buf,'/');
if (cp && cp[1]) {
char statPath[PATH_MAX];
snprintf(statPath, sizeof(statPath), "/zvfs/lib/web%s", cp);
Jsi_DecrRefCount(interp, fname);
fname = Jsi_ValueNewStringDup(interp, statPath);
Jsi_IncrRefCount(interp, fname);
if (!Jsi_Stat(interp, fname, &jsb) && jsb.st_size>0) {
native = 0;
goto serve;
}
}
if (cmdPtr->noWarn==0 && !Jsi_Strstr(buf, "favicon.ico"))
fprintf(stderr, "failed open file for read: %s\n", buf);
rc = jsi_wsServeString(pss, wsi, "<b style='color:red'>ERROR: can not serve file!</b>", 404, NULL, NULL);
}
Jsi_DecrRefCount(interp, fname);
goto done;
}
if (!ext || isSSI)
goto serve;
if (S_ISDIR(jsb.st_mode)) {
if (cmdPtr->noWarn==0)
fprintf(stderr, "can not serve directory: %s\n", buf);
rc = jsi_wsServeString(pss, wsi, "<b style='color:red'>ERROR: can not serve directory!</b>", 404, NULL, NULL);
Jsi_DecrRefCount(interp, fname);
goto done;
}
serve:
n = 0;
// TODO: add automatic cookie mgmt?
/*
if (!strcmp((const char *)in, "/") &&
!lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_COOKIE)) {
gettimeofday(&tv, NULL);
n = sprintf(b64, "test=LWS_%u_%u_COOKIE;Max-Age=360000",
(unsigned int)tv.tv_sec,
(unsigned int)tv.tv_usec);
if (lws_add_http_header_by_name(wsi,
(unsigned char *)"set-cookie:",
(unsigned char *)b64, n, &p,
(unsigned char *)buffer + sizeof(buffer)))
return 1;
}*/
static const char stsStr[] = "max-age=15768000 ; includeSubDomains";
if (lws_is_ssl(wsi) && lws_add_http_header_by_name(wsi,
(uchar *) "Strict-Transport-Security:",
(uchar *) stsStr,
sizeof(stsStr)-1, &p, (uchar *)buffer + sizeof(buffer)))
goto bail;
n = p - buffer;
if (n>0)
Jsi_DSAppendLen(&hStr, (char*)buffer, n);
p = buffer;
if (isgzip) {
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HTTP_CONTENT_ENCODING,
(unsigned char *)"gzip", n, &p, end))
goto bail;
}
if (cmdPtr->headers && !jsi_wsAddHeader(interp, cmdPtr, wsi, cmdPtr->headers, &hStr))
goto bail;
if (pss->headers && !jsi_wsAddHeader(interp, cmdPtr, wsi, pss->headers, &hStr))
goto bail;
n = Jsi_DSLength(&hStr);
if (native && !isSSI && !isJsiWeb) {
if (!jsi_wsAddStdHeader(interp, cmdPtr, wsi, &hStr)) {
Jsi_DecrRefCount(interp, fname);
goto bail;
}
int hrc = lws_serve_http_file(wsi, buf, mime, Jsi_DSValue(&hStr), Jsi_DSLength(&hStr));
if (hrc >= 0 && cmdPtr->onModify)
jsi_wsFileAdd(interp, cmdPtr, fname);
Jsi_DecrRefCount(interp, fname);
if (hrc<0) {
if (cmdPtr->noWarn==0)
fprintf(stderr, "can not serve file (%d): %s\n", hrc, buf);
goto bail;
} else if (hrc > 0 && lws_http_transaction_completed(wsi))
goto bail;
} else {
// Need to read data for non-native files.
Jsi_DString dStr = {}, fStr = {};
if (isSSI)
rc = jsi_wsEvalSSI(interp, cmdPtr, fname, &fStr, 1, pss);
else {
rc = jsi_wsFileRead(interp, fname, &fStr, cmdPtr, pss);
if (isJsiWeb)
Jsi_DSAppend(&fStr, "\nwindow.jsiWebSocket=true;", NULL);
}
if (rc != JSI_OK) {
Jsi_DSFree(&fStr);
goto nofile;
}
int hrc = jsi_wsServeHeader(pss, wsi, (int)Jsi_DSLength(&fStr), 200, Jsi_DSValue(&hStr), mime, &dStr);
if (hrc>=0) {
Jsi_DSAppendLen(&dStr, Jsi_DSValue(&fStr), Jsi_DSLength(&fStr));
char *strVal = Jsi_DSValue(&dStr);
int strLen = Jsi_DSLength(&dStr);
hrc = jsi_wswrite(pss, wsi, (unsigned char*)strVal, strLen, LWS_WRITE_HTTP);
}
Jsi_DecrRefCount(interp, fname);
Jsi_DSFree(&dStr);
Jsi_DSFree(&fStr);
if (hrc<0) {
if (cmdPtr->noWarn==0)
fprintf(stderr, "can not serve data (%d): %s\n", hrc, buf);
goto bail;
} else if (hrc > 0 && lws_http_transaction_completed(wsi))
goto bail;
}
done:
Jsi_DSFree(&hStr);
return rc;
bail:
rc = 1;
goto done;
} | 3268 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_wscallback_http | jsi_wscallback_http( struct lws * wsi , enum lws_callback_reasons reason , void * user , void * in , size_t len) | ['wsi', 'reason', 'user', 'in', 'len'] | static int jsi_wscallback_http(struct lws *wsi,
enum lws_callback_reasons reason, void *user,
void *in, size_t len)
{
struct lws_context *context = lws_get_context(wsi);
const char *inPtr = (char*)in;
char client_name[128], client_ip[128];
const char *res = "";
#ifdef EXTERNAL_POLL
int m;
int fd = (int)(long)user;
#endif
jsi_wsCmdObj *cmdPtr = (jsi_wsCmdObj *)lws_context_user(context);
if (!cmdPtr) {
fprintf(stderr, "bad ws context\n");
return -1;
}
jsi_wsPss *pss = NULL;
Jsi_Interp *interp = cmdPtr->interp;
Jsi_Value* callPtr = NULL;
int rc = 0, deflt = 0;
WSSIGASSERT(cmdPtr, OBJ);
if (Jsi_InterpGone(interp))
cmdPtr->deleted = 1;
if (cmdPtr->debug>=128)
fprintf(stderr, "HTTP CALLBACK: len=%d, %p %d:%s\n", (int)len, user, reason, jsw_getReasonStr(reason));
switch (reason) {
#ifndef EXTERNAL_POLL
case LWS_CALLBACK_GET_THREAD_ID:
case LWS_CALLBACK_UNLOCK_POLL:
case LWS_CALLBACK_PROTOCOL_INIT:
case LWS_CALLBACK_ADD_POLL_FD:
case LWS_CALLBACK_DEL_POLL_FD:
case LWS_CALLBACK_CHANGE_MODE_POLL_FD:
case LWS_CALLBACK_LOCK_POLL:
return rc;
#else
/*
* callbacks for managing the external poll() array appear in
* protocol 0 callback
*/
case LWS_CALLBACK_ADD_POLL_FD:
if (jsi_wsnum_pollfds >= max_poll_elements) {
lwsl_err("LWS_CALLBACK_ADD_POLL_FD: too many sockets to track\n");
return 1;
}
fd_lookup[fd] = jsi_wsnum_pollfds;
jsi_wspollfds[jsi_wsnum_pollfds].fd = fd;
jsi_wspollfds[jsi_wsnum_pollfds].events = (int)(long)len;
jsi_wspollfds[jsi_wsnum_pollfds++].revents = 0;
break;
case LWS_CALLBACK_DEL_POLL_FD:
if (!--jsi_wsnum_pollfds)
break;
m = fd_lookup[fd];
/* have the last guy take up the vacant slot */
jsi_wspollfds[m] = jsi_wspollfds[jsi_wsnum_pollfds];
fd_lookup[jsi_wspollfds[jsi_wsnum_pollfds].fd] = m;
break;
#endif
default:
deflt = 1;
break;
}
if (deflt && cmdPtr->debug>16 && cmdPtr->debug<128) {
fprintf(stderr, "HTTP CALLBACK: len=%d, %p %d:%s\n", (int)len, user, reason, jsw_getReasonStr(reason));
}
switch (reason) {
case LWS_CALLBACK_WSI_DESTROY:
break;
#if (LWS_LIBRARY_VERSION_MAJOR>1)
// Handle GET file download in client mode.
case LWS_CALLBACK_RECEIVE_CLIENT_HTTP: {
char buffer[1024 + LWS_PRE];
char *px = buffer + LWS_PRE;
int lenx = sizeof(buffer) - LWS_PRE;
if (lws_http_client_read(wsi, &px, &lenx) < 0)
return -1;
break;
}
case LWS_CALLBACK_RECEIVE_CLIENT_HTTP_READ:
if (jsi_wsrecv_callback(interp, cmdPtr, pss, inPtr, len, 0) != JSI_OK)
rc = 1;
break;
case LWS_CALLBACK_COMPLETED_CLIENT_HTTP:
if (jsi_wsrecv_callback(interp, cmdPtr, pss, inPtr, len, 1) != JSI_OK)
rc = 1;
break;
case LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER:
if (cmdPtr->post) {
unsigned char **p = (unsigned char **)in, *end = (*p) + len;
int n = 0;
char buf[100];
Jsi_ValueString(interp, cmdPtr->post, &n);
snprintf(buf, sizeof(buf), "%d", n);
if (lws_add_http_header_by_token(wsi,
WSI_TOKEN_HTTP_CONTENT_LENGTH,
(unsigned char *)buf, 2, p, end))
return -1;
if (lws_add_http_header_by_token(wsi,
WSI_TOKEN_HTTP_CONTENT_TYPE,
(unsigned char *)"application/x-www-form-urlencoded", 33, p, end))
return -1;
/* inform lws we have http body to send */
lws_client_http_body_pending(wsi, 1);
lws_callback_on_writable(wsi);
}
break;
case LWS_CALLBACK_CLIENT_HTTP_WRITEABLE: {
int n = 0;
char *cps = Jsi_ValueString(interp, cmdPtr->post, &n);
char *buf = (char*)Jsi_Calloc(1, LWS_PRE + n + 1);
Jsi_Strcpy(buf + LWS_PRE, cps);
n = lws_write(wsi, (unsigned char *)&buf[LWS_PRE], strlen(&buf[LWS_PRE]), LWS_WRITE_HTTP);
Jsi_Free(buf);
if (n < 0)
return -1;
/* we only had one thing to send, so inform lws we are done
* if we had more to send, call lws_callback_on_writable(wsi);
* and just return 0 from callback. On having sent the last
* part, call the below api instead.*/
lws_client_http_body_pending(wsi, 0);
break;
}
#endif
case LWS_CALLBACK_FILTER_NETWORK_CONNECTION:
break;
case LWS_CALLBACK_PROTOCOL_INIT:
break;
case LWS_CALLBACK_CLOSED_HTTP:
if (cmdPtr->debug>2)
fprintf(stderr, "CLOSED\n");
if (!pss)
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 1);
if (pss)
jsi_wsdeletePss(pss);
break;
case LWS_CALLBACK_WSI_CREATE:
break;
case LWS_CALLBACK_CONFIRM_EXTENSION_OKAY:
break;
case LWS_CALLBACK_FILTER_HTTP_CONNECTION:
if (cmdPtr->debug>1)
fprintf(stderr, "FILTER CONNECTION: %s\n", inPtr);
pss = jsi_wsgetPss(cmdPtr, wsi, user, 1, 1);
Jsi_DSSet(&pss->url, inPtr);
jsi_wsgetUriArgValue(interp, wsi, &pss->query, &pss->queryObj);
if (cmdPtr->instCtx == context && (cmdPtr->clientName[0] || cmdPtr->clientIP[0])) {
pss->clientName = cmdPtr->clientName;
pss->clientIP = cmdPtr->clientIP;
}
Jsi_DSSetLength(&pss->dHdrs, 0);
pss->hdrNum = jsi_wsGetHeaders(pss, wsi, &pss->dHdrs, pss->hdrSz, sizeof(pss->hdrSz)/sizeof(int));
if (cmdPtr->onFilter && !cmdPtr->deleted) {
// 4 args: ws, id, url, bool
int killcon = 0, n = 0;
Jsi_Obj *oarg1;
Jsi_Value *vpargs, *vargs[10], *ret = Jsi_ValueNew1(interp);
vargs[n++] = Jsi_ValueNewObj(interp, cmdPtr->fobj);
vargs[n++] = Jsi_ValueNewNumber(interp, (Jsi_Number)(pss->wid));
vargs[n++] = Jsi_ValueNewBlob(interp, (uchar*)in, len);
vargs[n++] = Jsi_ValueNewBoolean(interp, 1);
vpargs = Jsi_ValueMakeObject(interp, NULL, oarg1 = Jsi_ObjNewArray(interp, vargs, n, 0));
Jsi_IncrRefCount(interp, vpargs);
Jsi_ValueMakeUndef(interp, &ret);
rc = Jsi_FunctionInvoke(interp, cmdPtr->onFilter, vpargs, &ret, NULL);
if (rc == JSI_OK && Jsi_ValueIsFalse(interp, ret)) {
if (cmdPtr->debug>1)
fprintf(stderr, "WS:KILLING CONNECTION: %p\n", pss);
killcon = 1;
}
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK) {
Jsi_LogError("websock bad rcv eval");
return 1;
}
if (killcon)
return 1;
}
break;
case LWS_CALLBACK_SERVER_NEW_CLIENT_INSTANTIATED:
client_name[0] = 0;
client_ip[0] = 0;
lws_get_peer_addresses(wsi, lws_get_socket_fd(wsi), client_name,
sizeof(client_name), client_ip, sizeof(client_ip));
if (client_name[0])
cmdPtr->clientName = Jsi_KeyAdd(interp, client_name);
if (client_ip[0])
cmdPtr->clientIP = Jsi_KeyAdd(interp, client_ip);
if (cmdPtr->clientName || cmdPtr->clientIP) {
const char *loname = cmdPtr->localhostName;
if (!loname) loname = "localhost";
cmdPtr->instCtx = context;
if (cmdPtr->debug>1)
fprintf(stderr, "Received network connect from %s (%s)\n",
cmdPtr->clientName, cmdPtr->clientIP);
#ifndef __WIN32
if (cmdPtr->local && (cmdPtr->clientName && Jsi_Strcmp(cmdPtr->clientName, loname))) {
if (cmdPtr->debug>1)
fprintf(stderr, "Dropping non-localhost connection\n");
return 1;
}
#endif
}
if (cmdPtr->maxConnects && cmdPtr->stats.connectCnt>=cmdPtr->maxConnects) {
if (cmdPtr->debug>1)
fprintf(stderr, "maxConnects exceeded: rejecting connection <%p>\n", user);
rc = -1;
}
/* if we returned non-zero from here, we kill the connection */
break;
case LWS_CALLBACK_HTTP:
{
Jsi_DString dStr;
Jsi_DSInit(&dStr);
if (cmdPtr->debug)
fprintf(stderr, "HTTP GET: %s\n", inPtr);
rc = jsi_wsHttp(interp, cmdPtr, wsi, user, context, inPtr, &dStr, pss);
Jsi_DSFree(&dStr);
if (rc<0)
return -1;
if (rc==1) {
goto try_to_reuse;
}
break;
}
#if (LWS_LIBRARY_VERSION_MAJOR>1)
case LWS_CALLBACK_HTTP_BODY: {
if (!pss)
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 1);
if (!pss) break;
callPtr = (pss->onUpload?pss->onUpload:cmdPtr->onUpload);
if (cmdPtr->maxUpload<=0 || !callPtr) {
if (cmdPtr->noWarn==0)
fprintf(stderr, "Upload disabled: maxUpload=%d, onUpload=%p\n", cmdPtr->maxUpload, callPtr);
return -1;
}
if (!pss->spa) {
/* create the POST argument parser */
if (!pss->paramv) {
if (cmdPtr->formParams && cmdPtr->formParams != jsi_wsparam_str)
Jsi_SplitStr(cmdPtr->formParams, &pss->paramc, &pss->paramv, ",", &pss->paramDS);
else {
pss->paramv = (typeof(pss->paramv))jsi_wsparam_names;
pss->paramc = ARRAY_SIZE(jsi_wsparam_names);
}
}
pss->spa = lws_spa_create(wsi, (const char*const*)pss->paramv,
pss->paramc, 4096, jsi_wsFileUploadCB, pss);
if (!pss->spa)
return -1;
pss->filename[0] = '\0';
pss->file_length = 0;
}
cmdPtr->stats.uploadLast = pss->stats.uploadLast = time(NULL);
/* let it parse the POST data */
if (lws_spa_process(pss->spa, inPtr, len))
return -1;
if (!pss->stats.uploadStart) {
cmdPtr->stats.uploadEnd = pss->stats.uploadEnd = 0;
cmdPtr->stats.uploadStart = pss->stats.uploadStart = time(NULL);
cmdPtr->stats.uploadCnt++;
pss->stats.uploadCnt++;
}
break;
}
case LWS_CALLBACK_HTTP_BODY_COMPLETION:
if (!pss) {
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 1);
callPtr = (pss&&pss->onUpload?pss->onUpload:cmdPtr->onUpload);
}
if (pss && pss->spa)
lws_spa_finalize(pss->spa);
res = Jsi_DSValue(&pss->resultStr);
if (!res[0]) {
if (!pss->resultCode)
res = "<html><body>Upload complete</body></html>";
else
res = "<html><body>Upload error</body></html>";
}
jsi_wsServeString(pss, wsi, res, pss->resultCode==JSI_OK?0:500, NULL, NULL);
if (cmdPtr->maxUpload<=0 || !callPtr) {
if (cmdPtr->noWarn==0)
fprintf(stderr, "Upload disabled: maxUpload=%d, onUpload=%p\n", cmdPtr->maxUpload, callPtr);
return -1;
}
cmdPtr->stats.uploadEnd = pss->stats.uploadEnd = time(NULL);
lws_return_http_status(wsi, HTTP_STATUS_OK, NULL);
goto try_to_reuse;
case LWS_CALLBACK_HTTP_DROP_PROTOCOL:
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 1);
if (pss && pss->spa) {
lws_spa_destroy(pss->spa);
pss->spa = NULL;
}
break;
#endif
case LWS_CALLBACK_HTTP_FILE_COMPLETION:
goto try_to_reuse;
case LWS_CALLBACK_HTTP_WRITEABLE: {
lwsl_info("LWS_CALLBACK_HTTP_WRITEABLE\n");
if (!pss)
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 1);
if (!pss || !pss->fop_fd)
goto try_to_reuse;
/*
* we can send more of whatever it is we were sending
*/
int sent = 0;
unsigned char buffer[JSI_BUFSIZ*10 + LWS_PRE];
do {
int n = sizeof(buffer) - LWS_PRE;
int m = lws_get_peer_write_allowance(wsi);
if (m == 0)
goto later;
if (m != -1 && m < n)
n = m;
lws_filepos_t amount = 0;
n = lws_vfs_file_read(pss->fop_fd, &amount, buffer + LWS_PRE, n);
if (n < 0) {
lwsl_err("problem reading file\n");
goto bail;
}
n = (int)amount;
if (n == 0)
goto penultimate;
/*
* To support HTTP2, must take care about preamble space
*
* identification of when we send the last payload frame
* is handled by the library itself if you sent a
* content-length header
*/
m = jsi_wswrite(pss, wsi, buffer + LWS_PRE, n, LWS_WRITE_HTTP);
if (m < 0) {
lwsl_err("write failed\n");
/* write failed, close conn */
goto bail;
}
if (m) /* while still active, extend timeout */
lws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_CONTENT, 5);
sent += m;
} while (!lws_send_pipe_choked(wsi) && (sent < 500 * 1024 * 1024));
later:
lws_callback_on_writable(wsi);
break;
penultimate:
lws_vfs_file_close(&pss->fop_fd);
goto try_to_reuse;
bail:
lws_vfs_file_close(&pss->fop_fd);
rc = -1;
goto doret;
}
default:
break;
}
goto doret;
try_to_reuse:
if (lws_http_transaction_completed(wsi))
rc = -1;
else
rc = 0;
goto doret;
doret:
if (cmdPtr->debug>2)
fprintf(stderr, "<---HTTP RET = %d\n", rc);
return rc;
} | 2350 | True | 1 |
CVE-2020-22873 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'name': 'https://github.com/pcmacdon/jsish/commit/430ea27accd4d4ffddc946c9402e7c9064835a18', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.7', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Buffer overflow vulnerability in function NumberToPrecisionCmd in jsish before 3.0.7, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | pmacdona | 2020-04-13 19:04:14+00:00 | Release "3.0.7": Fix toPrecision bug "stack overflow #4".
FossilOrigin-Name: 6c7f0c37027d7f890b57cb38f776af39b8f81f03e60ceeb0a231a1d21e24b5de | 430ea27accd4d4ffddc946c9402e7c9064835a18 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_wscallback_websock | jsi_wscallback_websock( struct lws * wsi , enum lws_callback_reasons reason , void * user , void * in , size_t len) | ['wsi', 'reason', 'user', 'in', 'len'] | jsi_wscallback_websock(struct lws *wsi,
enum lws_callback_reasons reason,
void *user, void *in, size_t len)
{
struct lws_context *context = lws_get_context(wsi);
jsi_wsPss *pss = NULL;
jsi_wsCmdObj *cmdPtr = (jsi_wsCmdObj *)lws_context_user(context);
if (!cmdPtr) {
fprintf(stderr, "null ws context\n");
return -1;
}
Jsi_Interp *interp = cmdPtr->interp;
char *inPtr = (char*)in;
int sLen, n, rc =0;
WSSIGASSERT(cmdPtr, OBJ);
if (Jsi_InterpGone(interp))
cmdPtr->deleted = 1;
if (cmdPtr->debug>=32) {
switch (reason) {
case LWS_CALLBACK_SERVER_WRITEABLE:
case LWS_CALLBACK_CLIENT_WRITEABLE:
break;
default:
fprintf(stderr, "WS CALLBACK: len=%d, %p %d:%s\n", (int)len, user, reason, jsw_getReasonStr(reason));
}
}
switch (reason) {
case LWS_CALLBACK_PROTOCOL_INIT:
if (cmdPtr->noWebsock)
return 1;
break;
case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION:
pss = jsi_wsgetPss(cmdPtr, wsi, user, 1, 1);
Jsi_DSSet(&pss->url, inPtr);
if (cmdPtr->instCtx == context && (cmdPtr->clientName[0] || cmdPtr->clientIP[0])) {
pss->clientName = cmdPtr->clientName;
pss->clientIP = cmdPtr->clientIP;
}
if (cmdPtr->onFilter && !cmdPtr->deleted) {
if (!pss)
pss = jsi_wsgetPss(cmdPtr, wsi, user, 1, 0);
int killcon = 0, n = 0;
Jsi_Obj *oarg1;
Jsi_Value *vpargs, *vargs[10], *ret = Jsi_ValueNew1(interp);
vargs[n++] = Jsi_ValueNewObj(interp, cmdPtr->fobj);
vargs[n++] = Jsi_ValueNewNumber(interp, (Jsi_Number)(pss->wid));
vargs[n++] = Jsi_ValueNewBlob(interp, (uchar*)in, len);
vargs[n++] = Jsi_ValueNewBoolean(interp, 0);
vpargs = Jsi_ValueMakeObject(interp, NULL, oarg1 = Jsi_ObjNewArray(interp, vargs, n, 0));
Jsi_IncrRefCount(interp, vpargs);
Jsi_ValueMakeUndef(interp, &ret);
rc = Jsi_FunctionInvoke(interp, cmdPtr->onFilter, vpargs, &ret, NULL);
if (rc == JSI_OK && Jsi_ValueIsFalse(interp, ret)) {
if (cmdPtr->debug>1)
fprintf(stderr, "WS:KILLING CONNECTION: %p\n", user);
killcon = 1;
}
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK) {
Jsi_LogError("websock bad rcv eval");
return 1;
}
if (killcon)
return 1;
}
break;
case LWS_CALLBACK_CLIENT_ESTABLISHED:
case LWS_CALLBACK_ESTABLISHED:
if (cmdPtr->bufferPwr2>0) {
char nbuf[100];
snprintf(nbuf, sizeof(nbuf), "%d", cmdPtr->bufferPwr2);
lws_set_extension_option(wsi, "permessage-deflate", "rx_buf_size", nbuf);
lws_set_extension_option(wsi, "permessage-deflate", "tx_buf_size", nbuf);
}
if (!pss)
pss = jsi_wsgetPss(cmdPtr, wsi, user, 1, 0);
if (cmdPtr->onOpen && !cmdPtr->deleted) {
/* Pass 2 args: ws id. */
Jsi_Obj *oarg1;
Jsi_Value *vpargs, *vargs[10];
int n = 0;
vargs[n++] = Jsi_ValueNewObj(interp, cmdPtr->fobj);
vargs[n++] = Jsi_ValueNewNumber(interp, (Jsi_Number)(pss->wid));
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);
rc = Jsi_FunctionInvoke(interp, cmdPtr->onOpen, vpargs, &ret, NULL);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, ret);
if (rc != JSI_OK)
return Jsi_LogError("websock bad rcv eval");
}
break;
case LWS_CALLBACK_WSI_DESTROY:
break;
case LWS_CALLBACK_CLOSED:
case LWS_CALLBACK_PROTOCOL_DESTROY:
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 0);
if (!pss) break;
if (cmdPtr->onClose || pss->onClose) {
rc = jsi_wsrecv_callback(interp, cmdPtr, pss, inPtr, len, 1);
if (rc != JSI_OK)
return Jsi_LogError("websock bad rcv eval");
}
jsi_wsdeletePss(pss);
if (cmdPtr->stats.connectCnt<=0 && cmdPtr->onCloseLast && !Jsi_InterpGone(interp)) {
Jsi_RC jrc;
Jsi_Value *retStr = Jsi_ValueNew1(interp);
// 1 args: ws
Jsi_Value *vpargs, *vargs[10];
int n = 0;
vargs[n++] = (cmdPtr->deleted?Jsi_ValueNewNull(interp):Jsi_ValueNewObj(interp, cmdPtr->fobj));
vpargs = Jsi_ValueMakeObject(interp, NULL, Jsi_ObjNewArray(interp, vargs, n, 0));
Jsi_IncrRefCount(interp, vpargs);
jrc = Jsi_FunctionInvoke(interp, cmdPtr->onCloseLast, vpargs, &retStr, NULL);
Jsi_DecrRefCount(interp, vpargs);
Jsi_DecrRefCount(interp, retStr);
if (Jsi_InterpGone(interp))
return JSI_ERROR;
return jrc;
}
break;
case LWS_CALLBACK_CLIENT_WRITEABLE:
case LWS_CALLBACK_SERVER_WRITEABLE: {
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 0);
if (!pss || !pss->stack) break;
if (pss->lastData)
Jsi_Free(pss->lastData);
n=0;
char *data = pss->lastData = (char*)Jsi_StackUnshift(pss->stack);
unsigned char *p;
if (data == NULL)
break;
pss->stats.msgQLen--;
pss->state = PWS_SENT;
p = (unsigned char *)data+LWS_PRE;
sLen = Jsi_Strlen((char*)p);
n = jsi_wswrite(pss, wsi, p, sLen, (pss->stats.isBinary?LWS_WRITE_BINARY:LWS_WRITE_TEXT));
if (cmdPtr->debug>=10)
fprintf(stderr, "WS:CLIENT WRITE(%p): %d=>%d\n", pss, sLen, n);
if (n >= 0) {
cmdPtr->stats.sentCnt++;
cmdPtr->stats.sentLast = time(NULL);
pss->stats.sentCnt++;
pss->stats.sentLast = time(NULL);
} else {
lwsl_err("ERROR %d writing to socket\n", n);
pss->state = PWS_SENDERR;
pss->stats.sentErrCnt++;
pss->stats.sentErrLast = time(NULL);
cmdPtr->stats.sentErrCnt++;
cmdPtr->stats.sentErrLast = time(NULL);
rc = 1;
}
break;
}
case LWS_CALLBACK_CLIENT_RECEIVE:
case LWS_CALLBACK_RECEIVE:
{
pss = jsi_wsgetPss(cmdPtr, wsi, user, 0, 0);
if (!pss) break;
pss->stats.recvCnt++;
pss->stats.recvLast = time(NULL);
cmdPtr->stats.recvCnt++;
cmdPtr->stats.recvLast = time(NULL);
if (cmdPtr->onRecv || pss->onRecv) {
/* Pass 2 args: id and data. */
int nlen = len;
if (nlen<=0)
return 0;
int rblen = Jsi_DSLength(&pss->recvBuf),
bmax = cmdPtr->recvBufMax,
isfin = pss->stats.isFinal = lws_is_final_fragment(wsi);
pss->stats.isBinary = lws_frame_is_binary(wsi);
if (rblen) {
if (bmax && rblen>bmax) {
fprintf(stderr, "WS: Recv exceeds recvBufMax: %d>%d\n", rblen, bmax);
rc = 1;
break;
}
Jsi_DSAppendLen(&pss->recvBuf, inPtr, len);
if (!isfin) break;
cmdPtr->recvBufCnt--;
nlen = Jsi_DSLength(&pss->recvBuf);
inPtr = Jsi_DSFreeDup(&pss->recvBuf);
} else {
if (!isfin) {
cmdPtr->recvBufCnt++;
Jsi_DSAppendLen(&pss->recvBuf, inPtr, len);
break;
}
}
rc = jsi_wsrecv_callback(interp, cmdPtr, pss, inPtr, nlen, 0);
if (inPtr != in)
Jsi_Free(inPtr);
if (rc != JSI_OK) {
Jsi_LogError("websock bad rcv eval");
return 1;
}
}
lws_callback_on_writable_all_protocol(cmdPtr->context, lws_get_protocol(wsi));
break;
}
default:
break;
}
return rc;
} | 1554 | True | 1 |
CVE-2020-22874 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'name': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/5', 'name': 'https://github.com/pcmacdon/jsish/issues/5', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.8', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjArraySizer in jsish before 3.0.8, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 21:13:17+00:00 | Release "3.0.8": Address Array alloc sizing issues from issue "integer overflow and buffer overflow #5".
FossilOrigin-Name: 8c46a1d465b358110dcfb271721d35fe843a1b52f2fa24ccc10094eb8aaf6fe4 | 858da537bde4de9d8c92466d5a866505310bc328 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ArrayFlatSub | jsi_ArrayFlatSub( Jsi_Interp * interp , Jsi_Obj * nobj , Jsi_Value * arr , int depth) | ['interp', 'nobj', 'arr', 'depth'] | static Jsi_RC jsi_ArrayFlatSub(Jsi_Interp *interp, Jsi_Obj* nobj, Jsi_Value *arr, int depth) {
int i, n = 0, len = jsi_SizeOfArray(interp, arr->d.obj);
if (len <= 0) return JSI_OK;
Jsi_RC rc = JSI_OK;
int clen = jsi_SizeOfArray(interp, nobj);
for (i = 0; i < len && rc == JSI_OK; i++) {
Jsi_Value *t = Jsi_ValueArrayIndex(interp, arr, i);
if (t && depth>0 && Jsi_ValueIsArray(interp, t))
rc = jsi_ArrayFlatSub(interp, nobj, t , depth-1);
else if (!Jsi_ValueIsUndef(interp, t))
Jsi_ObjArrayAdd(interp, nobj, t);
if ((++n + clen)>interp->maxArrayList)
return Jsi_LogError("array size exceeded");
}
return rc;
} | 167 | True | 1 |
CVE-2020-22874 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'name': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/5', 'name': 'https://github.com/pcmacdon/jsish/issues/5', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.8', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjArraySizer in jsish before 3.0.8, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 21:13:17+00:00 | Release "3.0.8": Address Array alloc sizing issues from issue "integer overflow and buffer overflow #5".
FossilOrigin-Name: 8c46a1d465b358110dcfb271721d35fe843a1b52f2fa24ccc10094eb8aaf6fe4 | 858da537bde4de9d8c92466d5a866505310bc328 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | CDataStructDefineCmd | CDataStructDefineCmd( Jsi_Interp * interp , Jsi_Value * args , Jsi_Value * _this , Jsi_Value ** ret , Jsi_Func * funcPtr) | ['interp', 'args', '_this', 'ret', 'funcPtr'] | static Jsi_RC CDataStructDefineCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_RC rc = JSI_OK;
Jsi_OptionTypedef *st = NULL;
jsi_csInitType(interp);
Jsi_Value *eval = NULL, *val = Jsi_ValueArrayIndex(interp, args, 0),
*flds = Jsi_ValueArrayIndex(interp, args, 1);
int vlen, flen, i, argc, clen = 0, arrCnt=0;
Jsi_DString fStr = {};
char **argv = NULL, *cmt, *eq, *cp, *ce, *cpval, ocp;
const char *vstr = Jsi_ValueString(interp, val, &vlen),
*fstr = Jsi_ValueString(interp, flds, &flen);
if (vstr) {
cmt = Jsi_Strstr(fstr, "//");
eq = Jsi_Strchr(fstr, '=');
Jsi_DString tStr = {fstr};
fstr=jsi_TrimStr(Jsi_DSValue(&tStr));
Jsi_SplitStr(fstr, &argc, &argv, (cmt?"\n":";"), &fStr);
Jsi_DSFree(&tStr);
if (!cmt && argc>0 && !argv[argc-1][0])
argc--;
if (eq) {
eval = Jsi_ValueNewArray(interp, NULL, 0);
Jsi_IncrRefCount(interp, eval);
}
} else if (!Jsi_ValueIsArray(interp,flds) || (argc=Jsi_ValueGetLength(interp, flds))<1)
return Jsi_LogError("arg 2 must be string or non-empty array");
if (argc>200)
return Jsi_LogError("too many fields: %d>200", argc);
Jsi_StructSpec *sl, *sf, recs[argc+2];
memset(recs, 0, sizeof(recs));
sl = recs+argc+1;
sf = recs;
SIGINIT(sl, OPTS_STRUCT);
if (vstr) {
sl->name = Jsi_KeyAdd(interp, vstr);
} else if (Jsi_OptionsProcess(interp, StructOptions, sl, val, 0) < 0) {
rc = JSI_ERROR;
goto bail;
}
if (!Jsi_StrIsAlnum(sl->name)) {
rc = Jsi_LogError("invalid struct name: %s", sl->name);
goto bail;
}
if (jsi_csStructGet(interp, sl->name)) {
rc = Jsi_LogError("struct already exists: %s", sl->name);
goto bail;
}
for (i = 0; i<argc; i++) {
Jsi_Number numVal = 0;
bool bVal, isbitset = 0;
Jsi_Value *inival = NULL;
sf = recs+i;
SIGINIT(sf, OPTS_FIELD);
if (!argv) {
val = Jsi_ValueArrayIndex(interp, flds, i);
if (!val || Jsi_OptionsProcess(interp, StructFieldOptions, sf, val, 0) < 0) {
rc = JSI_ERROR;
goto bail;
}
if (!Jsi_StrIsAlnum(sf->name) || !sf->type) {
rc = Jsi_LogError("invalid struct field name: %s", sf->name);
goto bail;
}
if (!Jsi_ValueObjLookup(interp, val, "init", 0) && (sf->type->flags&jsi_CTYP_STRUCT))
inival = Jsi_ValueNewBoolean(interp, true);
} else {
if (cmt) {
cp = Jsi_Strstr(argv[i], "//");
if (cp) {
*cp = 0;
cp += 2;
cp = jsi_TrimStr(cp);
sf->help = Jsi_KeyAdd(interp, cp);
}
cp = Jsi_Strchr(argv[i], ';');
if (cp) *cp = 0;
}
cp = Jsi_Strchr(argv[i], '=');
if (cp) {
if (!eval)
goto bail;
*cp++ = 0;
cp = jsi_TrimStr(cp);
int cplen = Jsi_Strlen(cp);
if (cplen>1 && (cp[0] == '\'' || cp[0] == '"') && cp[0] == cp[cplen-1]) {
cpval = cp+1;
cp[cplen-1] = 0;
inival = Jsi_ValueNewStringDup(interp, cpval);
}
else if (Jsi_GetDouble(interp, cp, &numVal) == JSI_OK)
inival = Jsi_ValueNewNumber(interp, numVal);
else if (Jsi_GetBool(interp, cp, &bVal) == JSI_OK)
inival = Jsi_ValueNewBoolean(interp, bVal);
else
inival = Jsi_ValueNewStringDup(interp, cp);
}
cp = argv[i];
while (*cp && isspace(*cp)) cp++;
ce = cp;
while (*ce && !isspace(*ce)) ce++;
ocp = *ce;
if (!ocp) {
rc = Jsi_LogError("bad field: %s", cp);
goto bail;
}
*ce = 0;
sf->type = Jsi_TypeLookup(interp, cp);
*ce = ocp;
if (!sf->type) {
rc = Jsi_LogError("unknown type: %s", argv[i]);
goto bail;
}
if (!inival && (sf->type->flags&jsi_CTYP_STRUCT))
inival = Jsi_ValueNewBoolean(interp, true);
cp = ce+1;
while (*cp && isspace(*cp)) cp++;
ce = cp;
while (*ce && (isalnum(*ce) || *ce == '_')) ce++;
ocp = *ce;
*ce = 0;
if (!*cp) {
rc = Jsi_LogError("missing or bad struct field name");
goto bail;
}
sf->name = Jsi_KeyAdd(interp, cp);
if (ocp) {
ce++;
clen = Jsi_Strlen(ce);
}
if (ocp == '@') {
isbitset = 1;
} else
if (ocp == ':') {
int bsiz = -1;
if (Jsi_GetInt(interp, ce, &bsiz,10) != JSI_OK || bsiz<=0 || bsiz>64) {
rc = Jsi_LogError("bad bit size: %s", ce);
goto bail;
}
sf->bits = bsiz;
} else if (ocp == '[' && clen>1 && ce[clen-1]==']') {
int asiz = -1;
ce[clen-1] = 0;
if (Jsi_GetInt(interp, ce, &asiz, 10) != JSI_OK || asiz<=0) {
rc = Jsi_LogError("bad size: %s", cp);
goto bail;
}
sf->arrSize = asiz;
} else if (ocp) {
rc = Jsi_LogError("bad field: %s", cp);
goto bail;
}
val = NULL;
}
if (inival) {
Jsi_Value *sval = Jsi_ValueNewObj(interp, NULL);
Jsi_ValueInsert(interp, sval, "init", inival, 0);
Jsi_ValueArraySet(interp, eval, sval, i);
}
bool isEnum = (sf->type && (sf->type->flags&jsi_CTYP_ENUM));
if (isbitset) {
if (!isEnum) {
rc = Jsi_LogError("bitset type is not an enum");
goto bail;
}
sf->flags |= JSI_OPT_BITSET_ENUM;
}
if (sf->arrSize) {
if (sf->arrSize>MAX_ARRAY_LIST) {
rc = Jsi_LogError("array size too big: %d >= %d", sf->arrSize, MAX_ARRAY_LIST);
goto bail;
}
if (sf->bits || isEnum) {
rc = Jsi_LogError("array of %s unsupported", (sf->bits?"bits":"enums"));
goto bail;
}
arrCnt++;
}
}
recs[argc].id = JSI_OPTION_END;
rc = jsi_csSetupStruct(interp, sl, recs, recs, argc, &st, arrCnt);
if (rc != JSI_OK || !st) {
rc = JSI_ERROR;
goto bail;
}
sl = jsi_csGetStructSpec(st->extData);
sf = jsi_csGetFieldSpec(sl->extData);
if (vstr)
flds = eval;
for (i = 0; i<argc && flds; i++) {
val = Jsi_ValueArrayIndex(interp, flds, i);
if (val && Jsi_OptionsProcess(interp, StructFieldOptions, sf+i, val, JSI_OPT_PASS2) < 0) {
rc = JSI_ERROR;
goto bail;
}
}
bail:
if (eval)
Jsi_DecrRefCount(interp, eval);
Jsi_DSFree(&fStr);
if (rc != JSI_OK && st)
Jsi_HashEntryDelete(st->hPtr);
return rc;
} | 1572 | True | 1 |
CVE-2020-22874 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'name': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/5', 'name': 'https://github.com/pcmacdon/jsish/issues/5', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.8', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjArraySizer in jsish before 3.0.8, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 21:13:17+00:00 | Release "3.0.8": Address Array alloc sizing issues from issue "integer overflow and buffer overflow #5".
FossilOrigin-Name: 8c46a1d465b358110dcfb271721d35fe843a1b52f2fa24ccc10094eb8aaf6fe4 | 858da537bde4de9d8c92466d5a866505310bc328 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_InterpNew | jsi_InterpNew( Jsi_Interp * parent , Jsi_Value * opts , Jsi_InterpOpts * iopts) | ['parent', 'opts', 'iopts'] | static Jsi_Interp* jsi_InterpNew(Jsi_Interp *parent, Jsi_Value *opts, Jsi_InterpOpts *iopts)
{
Jsi_Interp* interp;
if (parent && parent->noSubInterps) {
interp = parent;
Jsi_LogError("subinterps disallowed");
return NULL;
}
if (opts && parent && (Jsi_ValueIsObjType(parent, opts, JSI_OT_OBJECT)==0 ||
Jsi_TreeSize(opts->d.obj->tree)<=0))
opts = NULL;
interp = (Jsi_Interp *)Jsi_Calloc(1,sizeof(*interp) + sizeof(jsi_Frame));
interp->framePtr = (jsi_Frame*)(((uchar*)interp)+sizeof(*interp));
if (!parent)
interp->maxInterpDepth = JSI_MAX_SUBINTERP_DEPTH;
else {
interp->maxInterpDepth = parent->maxInterpDepth;
interp->interpDepth = parent->interpDepth+1;
if (interp->interpDepth > interp->maxInterpDepth) {
Jsi_Free(interp);
interp = parent;
Jsi_LogError("exceeded max subinterp depth");
return NULL;
}
}
interp->maxDepth = JSI_MAX_EVAL_DEPTH;
interp->maxIncDepth = JSI_MAX_INCLUDE_DEPTH;
interp->typeWarnMax = 50;
interp->subOpts.dblPrec = __DBL_DECIMAL_DIG__-1;
interp->subOpts.prompt = "$ ";
interp->subOpts.prompt2 = "> ";
int iocnt;
if (iopts) {
iopts->interp = interp;
interp->opts = *iopts;
}
interp->logOpts.file = 1;
interp->logOpts.func = 1;
interp->logOpts.Info = 1;
interp->logOpts.Warn = 1;
interp->logOpts.Error = 1;
int argc = interp->opts.argc;
char **argv = interp->opts.argv;
char *argv0 = (argv?argv[0]:NULL);
interp->parent = parent;
interp->topInterp = (parent == NULL ? interp: parent->topInterp);
if (jsiIntData.mainInterp == NULL)
jsiIntData.mainInterp = interp->topInterp;
interp->mainInterp = jsiIntData.mainInterp; // The first interps handles exit.
interp->memDebug = interp->opts.mem_debug;
if (parent) {
interp->dbPtr = parent->dbPtr;
} else {
interp->dbPtr = &interp->dbStatic;
}
#ifdef JSI_MEM_DEBUG
if (!interp->dbPtr->valueDebugTbl) {
interp->dbPtr->valueDebugTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, NULL);
interp->dbPtr->objDebugTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, NULL);
}
#endif
if (parent) {
if (parent->pkgDirs)
interp->pkgDirs = Jsi_ValueDupJSON(interp, parent->pkgDirs);
} else {
#ifdef JSI_PKG_DIRS
interp->pkgDirs = Jsi_StringSplit(interp, JSI_PKG_DIRS, ",");
Jsi_IncrRefCount(interp, interp->pkgDirs);
#endif
}
#ifdef JSI_USE_COMPAT
interp->compat = JSI_USE_COMPAT;
#endif
#ifndef JSI_CONF_ARGS
#define JSI_CONF_ARGS ""
#endif
interp->confArgs = JSI_CONF_ARGS;
for (iocnt = 1; (iocnt+1)<argc; iocnt+=2)
{
const char *aio = argv[iocnt];
if (Jsi_Strcmp(aio, "--T") == 0 || Jsi_Strcmp(aio, "--C") == 0 || Jsi_Strcmp(aio, "--L") == 0) {
continue;
}
if (Jsi_Strcmp(aio, "--F") == 0 || Jsi_Strcmp(aio, "--U") == 0 || Jsi_Strcmp(aio, "--V") == 0) {
iocnt--;
continue;
}
if (!Jsi_Strcmp(aio, "--I")) {
const char *aio2 = argv[iocnt+1];
if (!Jsi_Strncmp("memDebug:", aio2, sizeof("memDebug")))
interp->memDebug=strtol(aio2+sizeof("memDebug"), NULL, 0);
else if (!Jsi_Strncmp("compat", aio2, sizeof("compat")))
interp->subOpts.compat=strtol(aio2+sizeof("compat"), NULL, 0);
continue;
}
break;
}
SIGINIT(interp,INTERP);
interp->NullValue = Jsi_ValueNewNull(interp);
Jsi_IncrRefCount(interp, interp->NullValue);
#ifdef __WIN32
Jsi_DString cwdStr;
Jsi_DSInit(&cwdStr);
interp->curDir = Jsi_Strdup(Jsi_GetCwd(interp, &cwdStr));
Jsi_DSFree(&cwdStr);
#else
char buf[JSI_BUFSIZ];
interp->curDir = getcwd(buf, sizeof(buf));
interp->curDir = Jsi_Strdup(interp->curDir?interp->curDir:".");
#endif
interp->onDeleteTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, freeOnDeleteTbl);
interp->assocTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, freeAssocTbl);
interp->cmdSpecTbl = Jsi_MapNew(interp, JSI_MAP_TREE, JSI_KEYS_STRING, freeCmdSpecTbl);
interp->eventTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, freeEventTbl);
interp->fileTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, jsi_HashFree);
interp->funcObjTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, freeFuncObjTbl);
interp->funcsTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, freeFuncsTbl);
interp->bindTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, freeBindObjTbl);
interp->protoTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, NULL/*freeValueTbl*/);
interp->regexpTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, regExpFree);
interp->preserveTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, jsi_HashFree);
interp->loadTbl = (parent?parent->loadTbl:Jsi_HashNew(interp, JSI_KEYS_STRING, jsi_FreeOneLoadHandle));
interp->packageHash = Jsi_HashNew(interp, JSI_KEYS_STRING, packageHashFree);
interp->aliasHash = Jsi_HashNew(interp, JSI_KEYS_STRING, jsi_AliasFree);
interp->lockTimeout = -1;
#ifdef JSI_LOCK_TIMEOUT
interp->lockTimeout JSI_LOCK_TIMEOUT;
#endif
#ifndef JSI_DO_UNLOCK
#define JSI_DO_UNLOCK 1
#endif
interp->subOpts.mutexUnlock = JSI_DO_UNLOCK;
Jsi_Map_Type mapType = JSI_MAP_HASH;
#ifdef JSI_USE_MANY_STRKEY
mapType = JSI_MAP_TREE;
#endif
if (interp == jsiIntData.mainInterp || interp->threadId != jsiIntData.mainInterp->threadId) {
interp->strKeyTbl = Jsi_MapNew(interp, mapType, JSI_KEYS_STRING, NULL);
interp->subOpts.privKeys = 1;
}
// Handle interp options: -T value and -Ixxx value
for (iocnt = 1; (iocnt+1)<argc && !interp->parent; iocnt+=2)
{
const char *aio = argv[iocnt];
if (Jsi_Strcmp(aio, "--F") == 0) {
interp->traceCall |= (jsi_callTraceFuncs |jsi_callTraceArgs |jsi_callTraceReturn | jsi_callTraceBefore | jsi_callTraceFullPath);
iocnt--;
interp->iskips++;
continue;
}
if (Jsi_Strcmp(aio, "--U") == 0) {
interp->asserts = 1;
interp->unitTest = 1;
iocnt--;
interp->iskips++;
continue;
}
if (Jsi_Strcmp(aio, "--V") == 0) {
interp->asserts = 1;
interp->unitTest = 5;
interp->tracePuts = 1;
iocnt--;
interp->iskips++;
continue;
}
if (Jsi_Strcmp(aio, "--C") == 0) {
if (interp->confFile)
Jsi_LogWarn("overriding confFile: %s", interp->confFile);
interp->confFile = argv[iocnt+1];
interp->iskips+=2;
continue;
}
if (Jsi_Strcmp(aio, "--L") == 0) {
struct stat sb;
const char* path = argv[iocnt+1]; //TODO: convert to Jsi_Value first?
if (!path || stat(path, &sb)
|| !((S_ISREG(sb.st_mode) && !access(path, W_OK)) || (S_ISDIR(sb.st_mode) && !access(path, X_OK)))) {
Jsi_LogError("Lockdown path must exist and be a writable file or executable dir: %s", path);
Jsi_InterpDelete(interp);
return NULL;
}
interp->isSafe = true;
interp->safeMode = jsi_safe_Lockdown;
if (interp->safeWriteDirs) {
Jsi_LogWarn("Overriding safeWriteDirs");
Jsi_DecrRefCount(interp, interp->safeWriteDirs);
}
const char *vda[2] = {};
char npath[PATH_MAX];
vda[0] = Jsi_FileRealpathStr(interp, path, npath);
interp->safeWriteDirs = Jsi_ValueNewArray(interp, vda, 1);
Jsi_IncrRefCount(interp, interp->safeWriteDirs);
if (!interp->safeReadDirs) {
interp->safeReadDirs = interp->safeWriteDirs;
Jsi_IncrRefCount(interp, interp->safeReadDirs);
}
interp->iskips+=2;
continue;
}
if (Jsi_Strcmp(aio, "--T") == 0) {
if (jsi_ParseTypeCheckStr(interp, argv[iocnt+1]) != JSI_OK) {
Jsi_InterpDelete(interp);
return NULL;
}
interp->iskips+=2;
continue;
}
if (!Jsi_Strcmp(aio, "--I")) {
bool bv = 1;
char *aio2 = argv[iocnt+1], *aioc = Jsi_Strchr(aio2, ':'),
argNamS[50], *argNam = aio2;
const char *argVal;
if (!Jsi_Strcmp("traceCall", aio2))
interp->traceCall |= (jsi_callTraceFuncs |jsi_callTraceArgs |jsi_callTraceReturn | jsi_callTraceBefore | jsi_callTraceFullPath);
else {
if (aioc) {
argNam = argNamS;
argVal = aioc+1;
snprintf(argNamS, sizeof(argNamS), "%.*s", (int)(aioc-aio2), aio2);
}
DECL_VALINIT(argV);
Jsi_Value *argValue = &argV;
Jsi_Number dv;
if (!aioc || Jsi_GetBool(interp, argVal, &bv) == JSI_OK) {
Jsi_ValueMakeBool(interp, &argValue, bv);
} else if (!Jsi_Strcmp("null", argVal)) {
Jsi_ValueMakeNull(interp, &argValue);
} else if (Jsi_GetDouble(interp, argVal, &dv) == JSI_OK) {
Jsi_ValueMakeNumber(interp, &argValue, dv);
} else {
Jsi_ValueMakeStringKey(interp, &argValue, argVal);
}
if (JSI_OK != Jsi_OptionsSet(interp, InterpOptions, interp, argNam, argValue, 0)) {
Jsi_InterpDelete(interp);
return NULL;
}
}
interp->iskips+=2;
continue;
}
break;
}
if (!interp->strKeyTbl)
interp->strKeyTbl = jsiIntData.mainInterp->strKeyTbl;
if (opts) {
interp->inopts = opts = Jsi_ValueDupJSON(interp, opts);
if (Jsi_OptionsProcess(interp, InterpOptions, interp, opts, 0) < 0) {
Jsi_DecrRefCount(interp, opts);
interp->inopts = NULL;
Jsi_InterpDelete(interp);
return NULL;
}
}
if (interp == jsiIntData.mainInterp) {
interp->subthread = 0;
} else {
if (opts) {
if (interp->subOpts.privKeys && interp->strKeyTbl == jsiIntData.mainInterp->strKeyTbl) {
//Jsi_HashDelete(interp->strKeyTbl);
Jsi_OptionsFree(interp, InterpOptions, interp, 0); /* Reparse options to populate new key table. */
interp->strKeyTbl = Jsi_MapNew(interp, mapType, JSI_KEYS_STRING, NULL);
if (opts->vt != JSI_VT_NULL) Jsi_OptionsProcess(interp, InterpOptions, interp, opts, 0);
} else if (interp->subOpts.privKeys == 0 && interp->strKeyTbl != jsiIntData.mainInterp->strKeyTbl) {
Jsi_OptionsFree(interp, InterpOptions, interp, 0); /* Reparse options to populate new key table. */
Jsi_MapDelete(interp->strKeyTbl);
interp->strKeyTbl = jsiIntData.mainInterp->strKeyTbl;
if (opts->vt != JSI_VT_NULL) Jsi_OptionsProcess(interp, InterpOptions, interp, opts, 0);
}
}
if (parent && parent->isSafe) {
interp->isSafe = 1;
interp->safeMode = parent->safeMode;
}
if (interp->subthread && interp->isSafe) {
interp->subthread = 0;
Jsi_LogError("threading disallowed in safe mode");
Jsi_InterpDelete(interp);
return NULL;
}
if (interp->subthread)
jsiIntData.mainInterp->threadCnt++;
if (interp->subthread && interp->strKeyTbl == jsiIntData.mainInterp->strKeyTbl)
jsiIntData.mainInterp->threadShrCnt++;
if (jsiIntData.mainInterp->threadShrCnt)
#ifdef JSI_USE_MANY_STRKEY
jsiIntData.mainInterp->strKeyTbl->v.tree->opts.lockTreeProc = KeyLockerTree;
#else
jsiIntData.mainInterp->strKeyTbl->v.hash->opts.lockHashProc = KeyLocker;
#endif
}
if (parent && parent->isSafe) {
interp->isSafe = 1;
interp->safeMode = parent->safeMode;
interp->maxOpCnt = parent->maxOpCnt;
if (interp->safeWriteDirs || interp->safeReadDirs || interp->safeExecPattern) {
Jsi_LogWarn("ignoring safe* options in safe sub-sub-interp");
if (interp->safeWriteDirs) Jsi_DecrRefCount(interp, interp->safeWriteDirs);
if (interp->safeReadDirs) Jsi_DecrRefCount(interp, interp->safeReadDirs);
interp->safeWriteDirs = interp->safeReadDirs = NULL;
interp->safeExecPattern = NULL;
}
}
jsi_InterpConfFiles(interp);
if (!interp->udata) {
interp->udata = Jsi_ValueNewObj(interp, NULL);
Jsi_IncrRefCount(interp, interp->udata);
}
if (interp->subthread && !interp->scriptStr && !interp->scriptFile) {
Jsi_LogError("subthread interp must be specify either scriptFile or scriptStr");
Jsi_InterpDelete(interp);
return NULL;
}
#ifndef JSI_MEM_DEBUG
static int warnNoDebug = 0;
if (interp->memDebug && warnNoDebug == 0) {
Jsi_LogWarn("ignoring memDebug as jsi was compiled without memory debugging");
warnNoDebug = 1;
}
#endif
interp->threadId = Jsi_CurrentThread();
if (interp->parent && interp->subthread==0 && interp->threadId != interp->parent->threadId) {
interp->threadId = interp->parent->threadId;
#ifndef JSI_MEM_DEBUG
Jsi_LogWarn("non-threaded sub-interp created by different thread than parent");
#endif
}
if (interp->safeMode != jsi_safe_None)
interp->isSafe = interp->startSafe = 1;
if (!interp->parent) {
if (interp->isSafe)
interp->startSafe = 1;
if (interp->debugOpts.msgCallback)
Jsi_LogWarn("ignoring msgCallback");
if (interp->debugOpts.putsCallback)
Jsi_LogWarn("ignoring putsCallback");
if (interp->busyCallback)
Jsi_LogWarn("ignoring busyCallback");
if (interp->debugOpts.traceCallback)
Jsi_LogWarn("ignoring traceCallback");
} else if (interp->busyCallback && interp->threadId != interp->parent->threadId) {
Jsi_LogWarn("disabling busyCallback due to threads");
interp->busyCallback = NULL;
}
if (interp == jsiIntData.mainInterp)
interp->lexkeyTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, NULL);
else
interp->lexkeyTbl = jsiIntData.mainInterp->lexkeyTbl;
interp->thisTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, freeValueTbl);
interp->userdataTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, freeUserdataTbl);
interp->varTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, NULL);
interp->codeTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, freeCodeTbl);
interp->genValueTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD,freeValueTbl);
interp->genObjTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, freeGenObjTbl);
#ifdef JSI_MEM_DEBUG
interp->codesTbl = (interp == jsiIntData.mainInterp ? Jsi_HashNew(interp, JSI_KEYS_ONEWORD, NULL) : jsiIntData.mainInterp->codesTbl);
#endif
if (interp->typeCheck.all|interp->typeCheck.parse|interp->typeCheck.funcsig)
interp->staticFuncsTbl = Jsi_HashNew(interp, JSI_KEYS_STRING, NULL);
interp->maxArrayList = MAX_ARRAY_LIST;
if (!jsiIntData.isInit) {
jsiIntData.isInit = 1;
jsi_InitValue(interp, 0);
jsiIntData.interpsTbl = Jsi_HashNew(interp, JSI_KEYS_ONEWORD, 0);
}
/* current scope, also global */
interp->csc = Jsi_ValueNew1(interp);
Jsi_ValueMakeObject(interp, &interp->csc, Jsi_ObjNew(interp));
interp->framePtr->incsc = interp->csc;
#define JSIDOINIT(nam) if (!jsi_ModBlacklisted(interp,#nam)) { if (jsi_Init##nam(interp, 0) != JSI_OK) { Jsi_LogBug("Init failure in %s", #nam); } }
#define JSIDOINIT2(nam) if (!jsi_ModBlacklisted(interp,#nam)) { if (Jsi_Init##nam(interp, 0) != JSI_OK) { Jsi_LogBug("Init failure in %s", #nam); } }
JSIDOINIT(Proto);
if (interp->pkgDirs) // Fix-up because above, array was not yet initialized.
interp->pkgDirs->d.obj->__proto__ = interp->Array_prototype;
Jsi_Value *modObj = Jsi_ValueNewObj(interp, Jsi_ObjNewType(interp, JSI_OT_OBJECT));
Jsi_ValueInsert(interp, interp->csc, "Jsi_Auto", modObj, JSI_OM_DONTDEL);
/* initial scope chain, nothing */
interp->framePtr->ingsc = interp->gsc = jsi_ScopeChainNew(interp, 0);
interp->ps = jsi_PstateNew(interp); /* Default parser. */
if (interp->unitTest&2) {
interp->logOpts.before = 1;
interp->logOpts.full = 1;
interp->tracePuts = 1;
interp->noStderr = 1;
}
if (interp->args && argc) {
Jsi_LogBug("args may not be specified both as options and parameter");
Jsi_InterpDelete(interp);
return NULL;
}
if (interp->maxDepth>JSI_MAX_EVAL_DEPTH)
interp->maxDepth = JSI_MAX_EVAL_DEPTH;
// Create the args array.
if (argc >= 0 && !interp->args) {
Jsi_Value *iargs = Jsi_ValueNew1(interp);
iargs->f.bits.dontdel = 1;
iargs->f.bits.readonly = 1;
Jsi_Obj *iobj = Jsi_ObjNew(interp);
Jsi_ValueMakeArrayObject(interp, &iargs, iobj);
int i = 1, ii = (iocnt>1 ? iocnt : 1);
int msiz = (argc?argc-iocnt:0);
Jsi_ObjArraySizer(interp, iobj, msiz);
iobj->arrMaxSize = msiz;
iocnt--;
iobj->arrCnt = argc-iocnt;
for (i = 1; ii < argc; ++ii, i++) {
iobj->arr[i-1] = Jsi_ValueNewStringKey(interp, argv[ii]);
Jsi_IncrRefCount(interp, iobj->arr[i-1]);
jsi_ValueDebugLabel(iobj->arr[i-1], "InterpCreate", "args");
}
Jsi_ObjSetLength(interp, iobj, msiz);
interp->args = iargs;
} else if (interp->parent && interp->args) {
// Avoid strings from sneeking in with options from parent...
Jsi_Value *nar = Jsi_ValueDupJSON(interp, interp->args);
Jsi_DecrRefCount(interp, interp->args);
interp->args = nar;
}
JSIDOINIT(Options);
JSIDOINIT(Cmds);
JSIDOINIT(Interp);
JSIDOINIT(JSON);
interp->retValue = Jsi_ValueNew1(interp);
interp->Mutex = Jsi_MutexNew(interp, -1, JSI_MUTEX_RECURSIVE);
if (1 || interp->subthread) {
interp->QMutex = Jsi_MutexNew(interp, -1, JSI_MUTEX_RECURSIVE);
//Jsi_DSInit(&interp->interpEvalQ);
}
JSIDOINIT(Lexer);
if (interp != jsiIntData.mainInterp && !parent)
Jsi_HashSet(jsiIntData.interpsTbl, interp, NULL);
if (!interp->isSafe) {
JSIDOINIT(Load);
#if JSI__SIGNAL==1
JSIDOINIT(Signal);
#endif
}
if (interp->isSafe == 0 || interp->startSafe || interp->safeWriteDirs!=NULL || interp->safeReadDirs!=NULL) {
#if JSI__FILESYS==1
JSIDOINIT(FileCmds);
JSIDOINIT(Filesys);
#endif
}
#if JSI__SQLITE==1
JSIDOINIT2(Sqlite);
#else
Jsi_initSqlite(interp, 0);
#endif
#if JSI__MYSQL==1
if (!interp->noNetwork) {
JSIDOINIT2(MySql);
}
#endif
#if JSI__SOCKET==1
JSIDOINIT2(Socket);
#endif
#if JSI__WEBSOCKET==1
JSIDOINIT2(WebSocket);
#endif
#if JSI__CDATA==1
JSIDOINIT(CData);
#endif
#ifdef JSI_USER_EXTENSION
extern int JSI_USER_EXTENSION(Jsi_Interp *interp, int release);
if (JSI_USER_EXTENSION (interp, 0) != JSI_OK) {
fprintf(stderr, "extension load failed");
return jsi_DoExit(interp, 1);
}
#endif
Jsi_PkgProvide(interp, "Jsi", JSI_VERSION, NULL);
if (argc > 0) {
char *ss = argv0;
char epath[PATH_MAX] = ""; // Path of executable
#ifdef __WIN32
if (GetModuleFileName(NULL, epath, sizeof(epath))>0)
ss = epath;
#else
#ifndef PROC_SELF_DIR
#define PROC_SELF_DIR "/proc/self/exe"
#endif
if (ss && *ss != '/' && readlink(PROC_SELF_DIR, epath, sizeof(epath)) && epath[0])
ss = epath;
#endif
Jsi_Value *src = Jsi_ValueNewStringDup(interp, ss);
Jsi_IncrRefCount(interp, src);
jsiIntData.execName = Jsi_Realpath(interp, src, NULL);
Jsi_DecrRefCount(interp, src);
if (!jsiIntData.execName) jsiIntData.execName = Jsi_Strdup("");
jsiIntData.execValue = Jsi_ValueNewString(interp, jsiIntData.execName, -1);
Jsi_IncrRefCount(interp, jsiIntData.execValue);
Jsi_HashSet(interp->genValueTbl, jsiIntData.execValue, jsiIntData.execValue);
}
//interp->nocacheOpCodes = 1;
if (interp->debugOpts.debugCallback && !interp->debugOpts.hook) {
interp->debugOpts.hook = jsi_InterpDebugHook;
}
interp->startTime = jsi_GetTimestamp();
#ifdef JSI_INTERP_EXTENSION_CODE // For extending interp from jsi.c
JSI_INTERP_EXTENSION_CODE
#endif
if (interp->opts.initProc && (*interp->opts.initProc)(interp, 0) != JSI_OK)
Jsi_LogBug("Init failure in initProc");
return interp;
} | 3631 | True | 1 |
CVE-2020-22874 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'name': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/5', 'name': 'https://github.com/pcmacdon/jsish/issues/5', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.8', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjArraySizer in jsish before 3.0.8, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 21:13:17+00:00 | Release "3.0.8": Address Array alloc sizing issues from issue "integer overflow and buffer overflow #5".
FossilOrigin-Name: 8c46a1d465b358110dcfb271721d35fe843a1b52f2fa24ccc10094eb8aaf6fe4 | 858da537bde4de9d8c92466d5a866505310bc328 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | Jsi_ObjArraySizer | Jsi_ObjArraySizer( Jsi_Interp * interp , Jsi_Obj * obj , uint len) | ['interp', 'obj', 'len'] | int Jsi_ObjArraySizer(Jsi_Interp *interp, Jsi_Obj *obj, uint len)
{
int nsiz = len + 1, mod = ALLOC_MOD_SIZE;
assert(obj->isarrlist);
if (mod>1)
nsiz = nsiz + ((mod-1) - (nsiz + mod - 1)%mod);
if (nsiz > MAX_ARRAY_LIST) {
Jsi_LogError("array size too large");
return 0;
}
if (len >= obj->arrMaxSize) {
int oldsz = (nsiz-obj->arrMaxSize);
obj->arr = (Jsi_Value**)Jsi_Realloc(obj->arr, nsiz*sizeof(Jsi_Value*));
memset(obj->arr+obj->arrMaxSize, 0, oldsz*sizeof(Jsi_Value*));
obj->arrMaxSize = nsiz;
}
if (len>obj->arrCnt)
obj->arrCnt = len;
return nsiz;
} | 165 | True | 1 |
CVE-2020-22874 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'name': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/5', 'name': 'https://github.com/pcmacdon/jsish/issues/5', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.8', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjArraySizer in jsish before 3.0.8, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 21:13:17+00:00 | Release "3.0.8": Address Array alloc sizing issues from issue "integer overflow and buffer overflow #5".
FossilOrigin-Name: 8c46a1d465b358110dcfb271721d35fe843a1b52f2fa24ccc10094eb8aaf6fe4 | 858da537bde4de9d8c92466d5a866505310bc328 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | ObjListifyCallback | ObjListifyCallback( Jsi_Tree * tree , Jsi_TreeEntry * hPtr , void * data) | ['tree', 'hPtr', 'data'] | static Jsi_RC ObjListifyCallback(Jsi_Tree *tree, Jsi_TreeEntry *hPtr, void *data)
{
Jsi_Interp *interp = tree->opts.interp;
Jsi_Obj *obj = (Jsi_Obj*)data;
int n;
if (!hPtr->f.bits.dontenum) {
char *ep = NULL, *cp = (char*)Jsi_TreeKeyGet(hPtr);
if (!cp || !isdigit(*cp))
return JSI_OK;
n = (int)strtol(cp, &ep, 0);
if (n<0 || n >= interp->maxArrayList)
return JSI_OK;
hPtr->f.bits.isarrlist = 1;
if (Jsi_ObjArraySizer(interp, obj, n) <= 0)
return Jsi_LogError("too long");
obj->arr[n] = (Jsi_Value*)Jsi_TreeValueGet(hPtr);
// obj->arrCnt++;
}
return JSI_OK;
} | 163 | True | 1 |
CVE-2020-22874 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'name': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/5', 'name': 'https://github.com/pcmacdon/jsish/issues/5', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.8', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjArraySizer in jsish before 3.0.8, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 21:13:17+00:00 | Release "3.0.8": Address Array alloc sizing issues from issue "integer overflow and buffer overflow #5".
FossilOrigin-Name: 8c46a1d465b358110dcfb271721d35fe843a1b52f2fa24ccc10094eb8aaf6fe4 | 858da537bde4de9d8c92466d5a866505310bc328 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | Jsi_ValueInsertArray | Jsi_ValueInsertArray( Jsi_Interp * interp , Jsi_Value * target , int key , Jsi_Value * val , int flags) | ['interp', 'target', 'key', 'val', 'flags'] | Jsi_RC Jsi_ValueInsertArray(Jsi_Interp *interp, Jsi_Value *target, int key, Jsi_Value *val, int flags)
{
if (target->vt != JSI_VT_OBJECT) {
if (interp->strict)
Jsi_LogWarn("Target is not object");
return JSI_ERROR;
}
Jsi_Obj *obj = target->d.obj;
if (obj->isarrlist) {
if (key >= 0 && key < interp->maxArrayList) {
Jsi_ObjArraySet(interp, obj, val, key);
return JSI_OK;
}
return JSI_ERROR;
}
char unibuf[JSI_MAX_NUMBER_STRING];
Jsi_NumberItoA10(key, unibuf, sizeof(unibuf));
Jsi_ObjInsert(interp, obj, unibuf, val, flags);
return JSI_OK;
} | 129 | True | 1 |
CVE-2020-22874 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'name': 'https://github.com/pcmacdon/jsish/commit/858da537bde4de9d8c92466d5a866505310bc328', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/pcmacdon/jsish/issues/5', 'name': 'https://github.com/pcmacdon/jsish/issues/5', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-190'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jsish:jsish:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.0.8', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Integer overflow vulnerability in function Jsi_ObjArraySizer in jsish before 3.0.8, allows remote attackers to execute arbitrary code.'}] | 2021-07-15T12:55Z | 2021-07-13T15:15Z | Integer Overflow or Wraparound | The software performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | An integer overflow or wraparound occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may wrap to become a very small or negative number. While this may be intended behavior in circumstances that rely on wrapping, it can have security consequences if the wrap is unexpected. This is especially the case if the integer overflow can be triggered using user-supplied inputs. This becomes security-critical when the result is used to control looping, make a security decision, or determine the offset or size in behaviors such as memory allocation, copying, concatenation, etc.
| https://cwe.mitre.org/data/definitions/190.html | 0 | pmacdona | 2020-04-13 21:13:17+00:00 | Release "3.0.8": Address Array alloc sizing issues from issue "integer overflow and buffer overflow #5".
FossilOrigin-Name: 8c46a1d465b358110dcfb271721d35fe843a1b52f2fa24ccc10094eb8aaf6fe4 | 858da537bde4de9d8c92466d5a866505310bc328 | False | pcmacdon/jsish | Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support. | 2016-07-08 13:28:40 | 2022-08-23 14:47:21 | https://jsish.org/ | pcmacdon | 29.0 | 5.0 | jsi_ValueObjKeyAssign | jsi_ValueObjKeyAssign( Jsi_Interp * interp , Jsi_Value * target , Jsi_Value * keyval , Jsi_Value * value , int flag) | ['interp', 'target', 'keyval', 'value', 'flag'] | Jsi_Value *jsi_ValueObjKeyAssign(Jsi_Interp *interp, Jsi_Value *target, Jsi_Value *keyval, Jsi_Value *value, int flag)
{
int arrayindex = -1;
if (keyval->vt == JSI_VT_NUMBER && Jsi_NumberIsInteger(keyval->d.num) && keyval->d.num >= 0) {
arrayindex = (int)keyval->d.num;
}
/* TODO: array["1"] also extern the length of array */
if (arrayindex >= 0 && arrayindex < MAX_ARRAY_LIST &&
target->vt == JSI_VT_OBJECT && target->d.obj->arr) {
return jsi_ObjArraySetDup(interp, target->d.obj, value, arrayindex);
}
const char *kstr = Jsi_ValueToString(interp, keyval, NULL);
#if (defined(JSI_HAS___PROTO__) && JSI_HAS___PROTO__==2)
if (Jsi_Strcmp(kstr, "__proto__")==0) {
Jsi_Obj *obj = target->d.obj;
obj->__proto__ = Jsi_ValueDup(interp, value);
//obj->clearProto = 1;
return obj->__proto__;
}
#endif
Jsi_Value *v = Jsi_ValueNew1(interp);
if (value)
Jsi_ValueCopy(interp, v, value);
jsi_ValueObjSet(interp, target, kstr, v, flag, (Jsi_ValueIsStringKey(interp, keyval)? JSI_OM_ISSTRKEY:0));
Jsi_DecrRefCount(interp, v);
return v;
} | 220 | True | 1 |
CVE-2020-23914 | False | False | False | True | AV:N/AC:M/Au:N/C:N/I:N/A:P | NETWORK | MEDIUM | NONE | NONE | NONE | PARTIAL | 4.3 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H | LOCAL | LOW | NONE | REQUIRED | UNCHANGED | NONE | NONE | HIGH | 5.5 | MEDIUM | 1.8 | 3.6 | False | [{'url': 'https://github.com/yhirose/cpp-peglib/issues/121', 'name': 'https://github.com/yhirose/cpp-peglib/issues/121', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/yhirose/cpp-peglib/commit/0061f393de54cf0326621c079dc2988336d1ebb3', 'name': 'https://github.com/yhirose/cpp-peglib/commit/0061f393de54cf0326621c079dc2988336d1ebb3', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-476'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:cpp-peglib_project:cpp-peglib:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.1.12', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'An issue was discovered in cpp-peglib through v0.1.12. A NULL pointer dereference exists in the peg::AstOptimizer::optimize() located in peglib.h. It allows an attacker to cause Denial of Service.'}] | 2021-04-26T17:22Z | 2021-04-21T18:15Z | NULL Pointer Dereference | A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit. | NULL pointer dereference issues can occur through a number of flaws, including race conditions, and simple programming omissions.
| https://cwe.mitre.org/data/definitions/476.html | 0 | yhirose | 2020-08-07 10:21:47-04:00 | Fix #121 | 0061f393de54cf0326621c079dc2988336d1ebb3 | False | yhirose/cpp-peglib | A single file C++ header-only PEG (Parsing Expression Grammars) library | 2015-02-07 21:10:11 | 2022-08-20 17:17:31 | yhirose | 602.0 | 74.0 | peg::LiteralString::LiteralString | peg::LiteralString::LiteralString( const std :: string & s , bool ignore_case) | ['s', 'ignore_case'] | LiteralString(const std::string &s, bool ignore_case)
: lit_(s), ignore_case_(ignore_case),
is_word_(false) {} | 29 | True | 1 |
|
CVE-2020-23914 | False | False | False | True | AV:N/AC:M/Au:N/C:N/I:N/A:P | NETWORK | MEDIUM | NONE | NONE | NONE | PARTIAL | 4.3 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H | LOCAL | LOW | NONE | REQUIRED | UNCHANGED | NONE | NONE | HIGH | 5.5 | MEDIUM | 1.8 | 3.6 | False | [{'url': 'https://github.com/yhirose/cpp-peglib/issues/121', 'name': 'https://github.com/yhirose/cpp-peglib/issues/121', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/yhirose/cpp-peglib/commit/0061f393de54cf0326621c079dc2988336d1ebb3', 'name': 'https://github.com/yhirose/cpp-peglib/commit/0061f393de54cf0326621c079dc2988336d1ebb3', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-476'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:cpp-peglib_project:cpp-peglib:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.1.12', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'An issue was discovered in cpp-peglib through v0.1.12. A NULL pointer dereference exists in the peg::AstOptimizer::optimize() located in peglib.h. It allows an attacker to cause Denial of Service.'}] | 2021-04-26T17:22Z | 2021-04-21T18:15Z | NULL Pointer Dereference | A NULL pointer dereference occurs when the application dereferences a pointer that it expects to be valid, but is NULL, typically causing a crash or exit. | NULL pointer dereference issues can occur through a number of flaws, including race conditions, and simple programming omissions.
| https://cwe.mitre.org/data/definitions/476.html | 0 | yhirose | 2020-08-07 10:21:47-04:00 | Fix #121 | 0061f393de54cf0326621c079dc2988336d1ebb3 | False | yhirose/cpp-peglib | A single file C++ header-only PEG (Parsing Expression Grammars) library | 2015-02-07 21:10:11 | 2022-08-20 17:17:31 | yhirose | 602.0 | 74.0 | peg::LiteralString::LiteralString | peg::LiteralString::LiteralString( std :: string && s , bool ignore_case) | ['s', 'ignore_case'] | LiteralString(std::string &&s, bool ignore_case)
: lit_(s), ignore_case_(ignore_case),
is_word_(false) {} | 28 | True | 1 |
|
CVE-2020-23915 | False | False | False | True | AV:N/AC:M/Au:N/C:N/I:N/A:P | NETWORK | MEDIUM | NONE | NONE | NONE | PARTIAL | 4.3 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H | LOCAL | LOW | NONE | REQUIRED | UNCHANGED | NONE | NONE | HIGH | 5.5 | MEDIUM | 1.8 | 3.6 | False | [{'url': 'https://github.com/yhirose/cpp-peglib/commit/b3b29ce8f3acf3a32733d930105a17d7b0ba347e', 'name': 'https://github.com/yhirose/cpp-peglib/commit/b3b29ce8f3acf3a32733d930105a17d7b0ba347e', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/yhirose/cpp-peglib/issues/122', 'name': 'https://github.com/yhirose/cpp-peglib/issues/122', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://cwe.mitre.org/data/definitions/126.html', 'name': 'https://cwe.mitre.org/data/definitions/126.html', 'refsource': 'MISC', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-125'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:cpp-peglib_project:cpp-peglib:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.1.12', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'An issue was discovered in cpp-peglib through v0.1.12. peg::resolve_escape_sequence() in peglib.h has a heap-based buffer over-read.'}] | 2022-07-10T21:15Z | 2021-04-21T18:15Z | Out-of-bounds Read | The software reads data past the end, or before the beginning, of the intended buffer. | Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
| https://cwe.mitre.org/data/definitions/125.html | 0 | yhirose | 2020-08-07 13:35:48-04:00 | Fix #122 | b3b29ce8f3acf3a32733d930105a17d7b0ba347e | False | yhirose/cpp-peglib | A single file C++ header-only PEG (Parsing Expression Grammars) library | 2015-02-07 21:10:11 | 2022-08-20 17:17:31 | yhirose | 602.0 | 74.0 | peg::codepoint_length | peg::codepoint_length( const char * s8 , size_t l) | ['s8', 'l'] | inline size_t codepoint_length(const char *s8, size_t l) {
if (l) {
auto b = static_cast<uint8_t>(s8[0]);
if ((b & 0x80) == 0) {
return 1;
} else if ((b & 0xE0) == 0xC0) {
return 2;
} else if ((b & 0xF0) == 0xE0) {
return 3;
} else if ((b & 0xF8) == 0xF0) {
return 4;
}
}
return 0;
} | 98 | True | 1 |
|
CVE-2020-24619 | False | False | False | False | AV:N/AC:M/Au:N/C:N/I:P/A:N | NETWORK | MEDIUM | NONE | NONE | PARTIAL | NONE | 4.3 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N | NETWORK | HIGH | NONE | NONE | UNCHANGED | NONE | HIGH | NONE | 5.9 | MEDIUM | 2.2 | 3.6 | False | [{'url': 'https://shotcut.org/blog/new-release-200913/', 'name': 'https://shotcut.org/blog/new-release-200913/', 'refsource': 'CONFIRM', 'tags': ['Release Notes', 'Vendor Advisory']}, {'url': 'https://github.com/mltframework/shotcut/commit/f008adc039642307f6ee3378d378cdb842e52c1d', 'name': 'https://github.com/mltframework/shotcut/commit/f008adc039642307f6ee3378d378cdb842e52c1d', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-295'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:meltytech:shotcut:*:*:*:*:*:*:*:*', 'versionEndExcluding': '20.09.13', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'In mainwindow.cpp in Shotcut before 20.09.13, the upgrade check misuses TLS because of setPeerVerifyMode(QSslSocket::VerifyNone). A man-in-the-middle attacker could offer a spoofed download resource.'}] | 2021-07-21T11:39Z | 2020-09-22T12:15Z | Improper Certificate Validation | The software does not validate, or incorrectly validates, a certificate. | When a certificate is invalid or malicious, it might allow an attacker to spoof a trusted entity by interfering in the communication path between the host and client. The software might connect to a malicious host while believing it is a trusted host, or the software might be deceived into accepting spoofed data that appears to originate from a trusted host.
| https://cwe.mitre.org/data/definitions/295.html | 0 | Dan Dennedy | 2020-08-22 14:03:33-07:00 | fix upgrade check is not using TLS correctly | f008adc039642307f6ee3378d378cdb842e52c1d | False | mltframework/shotcut | cross-platform (Qt), open-source (GPLv3) video editor | 2012-04-23 22:37:04 | 2022-08-27 23:48:43 | https://www.shotcut.org | mltframework | 6897.0 | 803.0 | MainWindow::on_actionUpgrade_triggered | MainWindow::on_actionUpgrade_triggered() | [] | void MainWindow::on_actionUpgrade_triggered()
{
if (Settings.askUpgradeAutmatic()) {
QMessageBox dialog(QMessageBox::Question,
qApp->applicationName(),
tr("Do you want to automatically check for updates in the future?"),
QMessageBox::No |
QMessageBox::Yes,
this);
dialog.setWindowModality(QmlApplication::dialogModality());
dialog.setDefaultButton(QMessageBox::Yes);
dialog.setEscapeButton(QMessageBox::No);
dialog.setCheckBox(new QCheckBox(tr("Do not show this anymore.", "Automatic upgrade check dialog")));
Settings.setCheckUpgradeAutomatic(dialog.exec() == QMessageBox::Yes);
if (dialog.checkBox()->isChecked())
Settings.setAskUpgradeAutomatic(false);
}
showStatusMessage("Checking for upgrade...");
m_network.get(QNetworkRequest(QUrl("http://check.shotcut.org/version.json")));
} | 143 | True | 1 |
CVE-2020-24619 | False | False | False | False | AV:N/AC:M/Au:N/C:N/I:P/A:N | NETWORK | MEDIUM | NONE | NONE | PARTIAL | NONE | 4.3 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N | NETWORK | HIGH | NONE | NONE | UNCHANGED | NONE | HIGH | NONE | 5.9 | MEDIUM | 2.2 | 3.6 | False | [{'url': 'https://shotcut.org/blog/new-release-200913/', 'name': 'https://shotcut.org/blog/new-release-200913/', 'refsource': 'CONFIRM', 'tags': ['Release Notes', 'Vendor Advisory']}, {'url': 'https://github.com/mltframework/shotcut/commit/f008adc039642307f6ee3378d378cdb842e52c1d', 'name': 'https://github.com/mltframework/shotcut/commit/f008adc039642307f6ee3378d378cdb842e52c1d', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-295'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:meltytech:shotcut:*:*:*:*:*:*:*:*', 'versionEndExcluding': '20.09.13', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'In mainwindow.cpp in Shotcut before 20.09.13, the upgrade check misuses TLS because of setPeerVerifyMode(QSslSocket::VerifyNone). A man-in-the-middle attacker could offer a spoofed download resource.'}] | 2021-07-21T11:39Z | 2020-09-22T12:15Z | Improper Certificate Validation | The software does not validate, or incorrectly validates, a certificate. | When a certificate is invalid or malicious, it might allow an attacker to spoof a trusted entity by interfering in the communication path between the host and client. The software might connect to a malicious host while believing it is a trusted host, or the software might be deceived into accepting spoofed data that appears to originate from a trusted host.
| https://cwe.mitre.org/data/definitions/295.html | 0 | Dan Dennedy | 2020-08-22 14:03:33-07:00 | fix upgrade check is not using TLS correctly | f008adc039642307f6ee3378d378cdb842e52c1d | False | mltframework/shotcut | cross-platform (Qt), open-source (GPLv3) video editor | 2012-04-23 22:37:04 | 2022-08-27 23:48:43 | https://www.shotcut.org | mltframework | 6897.0 | 803.0 | MainWindow::showUpgradePrompt | MainWindow::showUpgradePrompt() | [] | void MainWindow::showUpgradePrompt()
{
if (Settings.checkUpgradeAutomatic()) {
showStatusMessage("Checking for upgrade...");
QNetworkRequest request(QUrl("https://check.shotcut.org/version.json"));
QSslConfiguration sslConfig = request.sslConfiguration();
sslConfig.setPeerVerifyMode(QSslSocket::VerifyNone);
request.setSslConfiguration(sslConfig);
m_network.get(request);
} else {
m_network.setStrictTransportSecurityEnabled(false);
QAction* action = new QAction(tr("Click here to check for a new version of Shotcut."), 0);
connect(action, SIGNAL(triggered(bool)), SLOT(on_actionUpgrade_triggered()));
showStatusMessage(action, 15 /* seconds */);
}
} | 115 | True | 1 |
CVE-2020-24716 | False | False | False | False | AV:L/AC:L/Au:N/C:P/I:P/A:P | LOCAL | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 4.6 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | HIGH | HIGH | HIGH | 7.8 | HIGH | 1.8 | 5.9 | False | [{'url': 'https://jira.ixsystems.com/browse/NAS-107270', 'name': 'https://jira.ixsystems.com/browse/NAS-107270', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'name': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://reviews.freebsd.org/D26107', 'name': 'https://reviews.freebsd.org/D26107', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'name': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-863'}]}] | MEDIUM | [{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:openzfs:openzfs:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.8.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:freebsd:freebsd:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}] | [{'lang': 'en', 'value': 'OpenZFS before 2.0.0-rc1, when used on FreeBSD, allows execute permissions for all directories.'}] | 2021-07-21T11:39Z | 2020-08-27T19:15Z | Incorrect Authorization | The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. |
Assuming a user with a given identity, authorization is the process of determining whether that user can access a given resource, based on the user's privileges and any permissions or other access-control specifications that apply to the resource.
When access control checks are incorrectly applied, users are able to access data or perform actions that they should not be allowed to perform. This can lead to a wide range of problems, including information exposures, denial of service, and arbitrary code execution.
| https://cwe.mitre.org/data/definitions/863.html | 0 | Matthew Macy | 2020-08-18 09:57:07-07:00 | FreeBSD: Fix UNIX permissions checking
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10727 | 716b53d0a14c72bda16c0872565dd1909757e73f | False | openzfs/zfs | OpenZFS on Linux and FreeBSD | 2009-12-14 20:20:34 | 2022-08-27 19:30:11 | https://openzfs.github.io/openzfs-docs | openzfs | 8049.0 | 1493.0 | zfs_fastaccesschk_execute | zfs_fastaccesschk_execute( znode_t * zdp , cred_t * cr) | ['zdp', 'cr'] | zfs_fastaccesschk_execute(znode_t *zdp, cred_t *cr)
{
boolean_t owner = B_FALSE;
boolean_t groupmbr = B_FALSE;
boolean_t is_attr;
uid_t uid = crgetuid(cr);
if (zdp->z_pflags & ZFS_AV_QUARANTINED)
return (1);
is_attr = ((zdp->z_pflags & ZFS_XATTR) &&
(ZTOV(zdp)->v_type == VDIR));
if (is_attr)
return (1);
if (zdp->z_pflags & ZFS_NO_EXECS_DENIED)
return (0);
mutex_enter(&zdp->z_acl_lock);
if (FUID_INDEX(zdp->z_uid) != 0 || FUID_INDEX(zdp->z_gid) != 0) {
goto out_slow;
}
if (uid == zdp->z_uid) {
owner = B_TRUE;
if (zdp->z_mode & S_IXUSR) {
goto out;
} else {
goto out_slow;
}
}
if (groupmember(zdp->z_gid, cr)) {
groupmbr = B_TRUE;
if (zdp->z_mode & S_IXGRP) {
goto out;
} else {
goto out_slow;
}
}
if (!owner && !groupmbr) {
if (zdp->z_mode & S_IXOTH) {
goto out;
}
}
out:
mutex_exit(&zdp->z_acl_lock);
return (0);
out_slow:
mutex_exit(&zdp->z_acl_lock);
return (1);
} | 246 | True | 1 |
CVE-2020-24717 | False | False | False | False | AV:L/AC:L/Au:N/C:C/I:C/A:C | LOCAL | LOW | NONE | COMPLETE | COMPLETE | COMPLETE | 7.2 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | HIGH | HIGH | HIGH | 7.8 | HIGH | 1.8 | 5.9 | False | [{'url': 'https://jira.ixsystems.com/browse/NAS-107270', 'name': 'https://jira.ixsystems.com/browse/NAS-107270', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'name': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://reviews.freebsd.org/D26107', 'name': 'https://reviews.freebsd.org/D26107', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'name': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-276'}]}] | HIGH | [{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:openzfs:openzfs:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.8.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:freebsd:freebsd:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}] | [{'lang': 'en', 'value': 'OpenZFS before 2.0.0-rc1, when used on FreeBSD, misinterprets group permissions as user permissions, as demonstrated by mode 0770 being equivalent to mode 0777.'}] | 2020-09-04T16:20Z | 2020-08-27T19:15Z | Incorrect Default Permissions | During installation, installed file permissions are set to allow anyone to modify those files. | https://cwe.mitre.org/data/definitions/276.html | 0 | Matthew Macy | 2020-08-18 09:57:07-07:00 | FreeBSD: Fix UNIX permissions checking
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10727 | 716b53d0a14c72bda16c0872565dd1909757e73f | False | openzfs/zfs | OpenZFS on Linux and FreeBSD | 2009-12-14 20:20:34 | 2022-08-27 19:30:11 | https://openzfs.github.io/openzfs-docs | openzfs | 8049.0 | 1493.0 | zfs_fastaccesschk_execute | zfs_fastaccesschk_execute( znode_t * zdp , cred_t * cr) | ['zdp', 'cr'] | zfs_fastaccesschk_execute(znode_t *zdp, cred_t *cr)
{
boolean_t owner = B_FALSE;
boolean_t groupmbr = B_FALSE;
boolean_t is_attr;
uid_t uid = crgetuid(cr);
if (zdp->z_pflags & ZFS_AV_QUARANTINED)
return (1);
is_attr = ((zdp->z_pflags & ZFS_XATTR) &&
(ZTOV(zdp)->v_type == VDIR));
if (is_attr)
return (1);
if (zdp->z_pflags & ZFS_NO_EXECS_DENIED)
return (0);
mutex_enter(&zdp->z_acl_lock);
if (FUID_INDEX(zdp->z_uid) != 0 || FUID_INDEX(zdp->z_gid) != 0) {
goto out_slow;
}
if (uid == zdp->z_uid) {
owner = B_TRUE;
if (zdp->z_mode & S_IXUSR) {
goto out;
} else {
goto out_slow;
}
}
if (groupmember(zdp->z_gid, cr)) {
groupmbr = B_TRUE;
if (zdp->z_mode & S_IXGRP) {
goto out;
} else {
goto out_slow;
}
}
if (!owner && !groupmbr) {
if (zdp->z_mode & S_IXOTH) {
goto out;
}
}
out:
mutex_exit(&zdp->z_acl_lock);
return (0);
out_slow:
mutex_exit(&zdp->z_acl_lock);
return (1);
} | 246 | True | 1 |
|
CVE-2020-24716 | False | False | False | False | AV:L/AC:L/Au:N/C:P/I:P/A:P | LOCAL | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 4.6 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | HIGH | HIGH | HIGH | 7.8 | HIGH | 1.8 | 5.9 | False | [{'url': 'https://jira.ixsystems.com/browse/NAS-107270', 'name': 'https://jira.ixsystems.com/browse/NAS-107270', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'name': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://reviews.freebsd.org/D26107', 'name': 'https://reviews.freebsd.org/D26107', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'name': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-863'}]}] | MEDIUM | [{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:openzfs:openzfs:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.8.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:freebsd:freebsd:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}] | [{'lang': 'en', 'value': 'OpenZFS before 2.0.0-rc1, when used on FreeBSD, allows execute permissions for all directories.'}] | 2021-07-21T11:39Z | 2020-08-27T19:15Z | Incorrect Authorization | The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. |
Assuming a user with a given identity, authorization is the process of determining whether that user can access a given resource, based on the user's privileges and any permissions or other access-control specifications that apply to the resource.
When access control checks are incorrectly applied, users are able to access data or perform actions that they should not be allowed to perform. This can lead to a wide range of problems, including information exposures, denial of service, and arbitrary code execution.
| https://cwe.mitre.org/data/definitions/863.html | 0 | Matthew Macy | 2020-08-18 09:57:07-07:00 | FreeBSD: Fix UNIX permissions checking
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10727 | 716b53d0a14c72bda16c0872565dd1909757e73f | False | openzfs/zfs | OpenZFS on Linux and FreeBSD | 2009-12-14 20:20:34 | 2022-08-27 19:30:11 | https://openzfs.github.io/openzfs-docs | openzfs | 8049.0 | 1493.0 | zfs_fuid_create | zfs_fuid_create( zfsvfs_t * zfsvfs , uint64_t id , cred_t * cr , zfs_fuid_type_t type , zfs_fuid_info_t ** fuidpp) | ['zfsvfs', 'id', 'cr', 'type', 'fuidpp'] | zfs_fuid_create(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr,
zfs_fuid_type_t type, zfs_fuid_info_t **fuidpp)
{
#ifdef HAVE_KSID
const char *domain;
char *kdomain;
uint32_t fuid_idx = FUID_INDEX(id);
uint32_t rid;
idmap_stat status;
uint64_t idx = 0;
zfs_fuid_t *zfuid = NULL;
zfs_fuid_info_t *fuidp = NULL;
/*
* If POSIX ID, or entry is already a FUID then
* just return the id
*
* We may also be handed an already FUID'ized id via
* chmod.
*/
if (!zfsvfs->z_use_fuids || !IS_EPHEMERAL(id) || fuid_idx != 0)
return (id);
if (zfsvfs->z_replay) {
fuidp = zfsvfs->z_fuid_replay;
/*
* If we are passed an ephemeral id, but no
* fuid_info was logged then return NOBODY.
* This is most likely a result of idmap service
* not being available.
*/
if (fuidp == NULL)
return (UID_NOBODY);
VERIFY3U(type, >=, ZFS_OWNER);
VERIFY3U(type, <=, ZFS_ACE_GROUP);
switch (type) {
case ZFS_ACE_USER:
case ZFS_ACE_GROUP:
zfuid = list_head(&fuidp->z_fuids);
rid = FUID_RID(zfuid->z_logfuid);
idx = FUID_INDEX(zfuid->z_logfuid);
break;
case ZFS_OWNER:
rid = FUID_RID(fuidp->z_fuid_owner);
idx = FUID_INDEX(fuidp->z_fuid_owner);
break;
case ZFS_GROUP:
rid = FUID_RID(fuidp->z_fuid_group);
idx = FUID_INDEX(fuidp->z_fuid_group);
break;
};
domain = fuidp->z_domain_table[idx - 1];
} else {
if (type == ZFS_OWNER || type == ZFS_ACE_USER)
status = kidmap_getsidbyuid(crgetzone(cr), id,
&domain, &rid);
else
status = kidmap_getsidbygid(crgetzone(cr), id,
&domain, &rid);
if (status != 0) {
/*
* When returning nobody we will need to
* make a dummy fuid table entry for logging
* purposes.
*/
rid = UID_NOBODY;
domain = nulldomain;
}
}
idx = zfs_fuid_find_by_domain(zfsvfs, domain, &kdomain, B_TRUE);
if (!zfsvfs->z_replay)
zfs_fuid_node_add(fuidpp, kdomain,
rid, idx, id, type);
else if (zfuid != NULL) {
list_remove(&fuidp->z_fuids, zfuid);
kmem_free(zfuid, sizeof (zfs_fuid_t));
}
return (FUID_ENCODE(idx, rid));
#else
/*
* The Linux port only supports POSIX IDs, use the passed id.
*/
return (id);
#endif
} | 373 | True | 1 |
CVE-2020-24717 | False | False | False | False | AV:L/AC:L/Au:N/C:C/I:C/A:C | LOCAL | LOW | NONE | COMPLETE | COMPLETE | COMPLETE | 7.2 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | HIGH | HIGH | HIGH | 7.8 | HIGH | 1.8 | 5.9 | False | [{'url': 'https://jira.ixsystems.com/browse/NAS-107270', 'name': 'https://jira.ixsystems.com/browse/NAS-107270', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'name': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://reviews.freebsd.org/D26107', 'name': 'https://reviews.freebsd.org/D26107', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'name': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-276'}]}] | HIGH | [{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:openzfs:openzfs:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.8.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:freebsd:freebsd:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}] | [{'lang': 'en', 'value': 'OpenZFS before 2.0.0-rc1, when used on FreeBSD, misinterprets group permissions as user permissions, as demonstrated by mode 0770 being equivalent to mode 0777.'}] | 2020-09-04T16:20Z | 2020-08-27T19:15Z | Incorrect Default Permissions | During installation, installed file permissions are set to allow anyone to modify those files. | https://cwe.mitre.org/data/definitions/276.html | 0 | Matthew Macy | 2020-08-18 09:57:07-07:00 | FreeBSD: Fix UNIX permissions checking
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10727 | 716b53d0a14c72bda16c0872565dd1909757e73f | False | openzfs/zfs | OpenZFS on Linux and FreeBSD | 2009-12-14 20:20:34 | 2022-08-27 19:30:11 | https://openzfs.github.io/openzfs-docs | openzfs | 8049.0 | 1493.0 | zfs_fuid_create | zfs_fuid_create( zfsvfs_t * zfsvfs , uint64_t id , cred_t * cr , zfs_fuid_type_t type , zfs_fuid_info_t ** fuidpp) | ['zfsvfs', 'id', 'cr', 'type', 'fuidpp'] | zfs_fuid_create(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr,
zfs_fuid_type_t type, zfs_fuid_info_t **fuidpp)
{
#ifdef HAVE_KSID
const char *domain;
char *kdomain;
uint32_t fuid_idx = FUID_INDEX(id);
uint32_t rid;
idmap_stat status;
uint64_t idx = 0;
zfs_fuid_t *zfuid = NULL;
zfs_fuid_info_t *fuidp = NULL;
/*
* If POSIX ID, or entry is already a FUID then
* just return the id
*
* We may also be handed an already FUID'ized id via
* chmod.
*/
if (!zfsvfs->z_use_fuids || !IS_EPHEMERAL(id) || fuid_idx != 0)
return (id);
if (zfsvfs->z_replay) {
fuidp = zfsvfs->z_fuid_replay;
/*
* If we are passed an ephemeral id, but no
* fuid_info was logged then return NOBODY.
* This is most likely a result of idmap service
* not being available.
*/
if (fuidp == NULL)
return (UID_NOBODY);
VERIFY3U(type, >=, ZFS_OWNER);
VERIFY3U(type, <=, ZFS_ACE_GROUP);
switch (type) {
case ZFS_ACE_USER:
case ZFS_ACE_GROUP:
zfuid = list_head(&fuidp->z_fuids);
rid = FUID_RID(zfuid->z_logfuid);
idx = FUID_INDEX(zfuid->z_logfuid);
break;
case ZFS_OWNER:
rid = FUID_RID(fuidp->z_fuid_owner);
idx = FUID_INDEX(fuidp->z_fuid_owner);
break;
case ZFS_GROUP:
rid = FUID_RID(fuidp->z_fuid_group);
idx = FUID_INDEX(fuidp->z_fuid_group);
break;
};
domain = fuidp->z_domain_table[idx - 1];
} else {
if (type == ZFS_OWNER || type == ZFS_ACE_USER)
status = kidmap_getsidbyuid(crgetzone(cr), id,
&domain, &rid);
else
status = kidmap_getsidbygid(crgetzone(cr), id,
&domain, &rid);
if (status != 0) {
/*
* When returning nobody we will need to
* make a dummy fuid table entry for logging
* purposes.
*/
rid = UID_NOBODY;
domain = nulldomain;
}
}
idx = zfs_fuid_find_by_domain(zfsvfs, domain, &kdomain, B_TRUE);
if (!zfsvfs->z_replay)
zfs_fuid_node_add(fuidpp, kdomain,
rid, idx, id, type);
else if (zfuid != NULL) {
list_remove(&fuidp->z_fuids, zfuid);
kmem_free(zfuid, sizeof (zfs_fuid_t));
}
return (FUID_ENCODE(idx, rid));
#else
/*
* The Linux port only supports POSIX IDs, use the passed id.
*/
return (id);
#endif
} | 373 | True | 1 |
|
CVE-2020-24716 | False | False | False | False | AV:L/AC:L/Au:N/C:P/I:P/A:P | LOCAL | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 4.6 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | HIGH | HIGH | HIGH | 7.8 | HIGH | 1.8 | 5.9 | False | [{'url': 'https://jira.ixsystems.com/browse/NAS-107270', 'name': 'https://jira.ixsystems.com/browse/NAS-107270', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'name': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://reviews.freebsd.org/D26107', 'name': 'https://reviews.freebsd.org/D26107', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'name': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-863'}]}] | MEDIUM | [{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:openzfs:openzfs:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.8.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:freebsd:freebsd:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}] | [{'lang': 'en', 'value': 'OpenZFS before 2.0.0-rc1, when used on FreeBSD, allows execute permissions for all directories.'}] | 2021-07-21T11:39Z | 2020-08-27T19:15Z | Incorrect Authorization | The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. |
Assuming a user with a given identity, authorization is the process of determining whether that user can access a given resource, based on the user's privileges and any permissions or other access-control specifications that apply to the resource.
When access control checks are incorrectly applied, users are able to access data or perform actions that they should not be allowed to perform. This can lead to a wide range of problems, including information exposures, denial of service, and arbitrary code execution.
| https://cwe.mitre.org/data/definitions/863.html | 0 | Matthew Macy | 2020-08-18 09:57:07-07:00 | FreeBSD: Fix UNIX permissions checking
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10727 | 716b53d0a14c72bda16c0872565dd1909757e73f | False | openzfs/zfs | OpenZFS on Linux and FreeBSD | 2009-12-14 20:20:34 | 2022-08-27 19:30:11 | https://openzfs.github.io/openzfs-docs | openzfs | 8049.0 | 1493.0 | zfs_fuid_map_id | zfs_fuid_map_id( zfsvfs_t * zfsvfs , uint64_t fuid , cred_t * cr , zfs_fuid_type_t type) | ['zfsvfs', 'fuid', 'cr', 'type'] | zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid,
cred_t *cr, zfs_fuid_type_t type)
{
#ifdef HAVE_KSID
uint32_t index = FUID_INDEX(fuid);
const char *domain;
uid_t id;
if (index == 0)
return (fuid);
domain = zfs_fuid_find_by_idx(zfsvfs, index);
ASSERT(domain != NULL);
if (type == ZFS_OWNER || type == ZFS_ACE_USER) {
(void) kidmap_getuidbysid(crgetzone(cr), domain,
FUID_RID(fuid), &id);
} else {
(void) kidmap_getgidbysid(crgetzone(cr), domain,
FUID_RID(fuid), &id);
}
return (id);
#else
/*
* The Linux port only supports POSIX IDs, use the passed id.
*/
return (fuid);
#endif /* HAVE_KSID */
} | 128 | True | 1 |
CVE-2020-24717 | False | False | False | False | AV:L/AC:L/Au:N/C:C/I:C/A:C | LOCAL | LOW | NONE | COMPLETE | COMPLETE | COMPLETE | 7.2 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | HIGH | HIGH | HIGH | 7.8 | HIGH | 1.8 | 5.9 | False | [{'url': 'https://jira.ixsystems.com/browse/NAS-107270', 'name': 'https://jira.ixsystems.com/browse/NAS-107270', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'name': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://reviews.freebsd.org/D26107', 'name': 'https://reviews.freebsd.org/D26107', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'name': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-276'}]}] | HIGH | [{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:openzfs:openzfs:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.8.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:freebsd:freebsd:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}] | [{'lang': 'en', 'value': 'OpenZFS before 2.0.0-rc1, when used on FreeBSD, misinterprets group permissions as user permissions, as demonstrated by mode 0770 being equivalent to mode 0777.'}] | 2020-09-04T16:20Z | 2020-08-27T19:15Z | Incorrect Default Permissions | During installation, installed file permissions are set to allow anyone to modify those files. | https://cwe.mitre.org/data/definitions/276.html | 0 | Matthew Macy | 2020-08-18 09:57:07-07:00 | FreeBSD: Fix UNIX permissions checking
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10727 | 716b53d0a14c72bda16c0872565dd1909757e73f | False | openzfs/zfs | OpenZFS on Linux and FreeBSD | 2009-12-14 20:20:34 | 2022-08-27 19:30:11 | https://openzfs.github.io/openzfs-docs | openzfs | 8049.0 | 1493.0 | zfs_fuid_map_id | zfs_fuid_map_id( zfsvfs_t * zfsvfs , uint64_t fuid , cred_t * cr , zfs_fuid_type_t type) | ['zfsvfs', 'fuid', 'cr', 'type'] | zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid,
cred_t *cr, zfs_fuid_type_t type)
{
#ifdef HAVE_KSID
uint32_t index = FUID_INDEX(fuid);
const char *domain;
uid_t id;
if (index == 0)
return (fuid);
domain = zfs_fuid_find_by_idx(zfsvfs, index);
ASSERT(domain != NULL);
if (type == ZFS_OWNER || type == ZFS_ACE_USER) {
(void) kidmap_getuidbysid(crgetzone(cr), domain,
FUID_RID(fuid), &id);
} else {
(void) kidmap_getgidbysid(crgetzone(cr), domain,
FUID_RID(fuid), &id);
}
return (id);
#else
/*
* The Linux port only supports POSIX IDs, use the passed id.
*/
return (fuid);
#endif /* HAVE_KSID */
} | 128 | True | 1 |
|
CVE-2020-24716 | False | False | False | False | AV:L/AC:L/Au:N/C:P/I:P/A:P | LOCAL | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 4.6 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | HIGH | HIGH | HIGH | 7.8 | HIGH | 1.8 | 5.9 | False | [{'url': 'https://jira.ixsystems.com/browse/NAS-107270', 'name': 'https://jira.ixsystems.com/browse/NAS-107270', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'name': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://reviews.freebsd.org/D26107', 'name': 'https://reviews.freebsd.org/D26107', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'name': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-863'}]}] | MEDIUM | [{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:openzfs:openzfs:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.8.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:freebsd:freebsd:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}] | [{'lang': 'en', 'value': 'OpenZFS before 2.0.0-rc1, when used on FreeBSD, allows execute permissions for all directories.'}] | 2021-07-21T11:39Z | 2020-08-27T19:15Z | Incorrect Authorization | The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. |
Assuming a user with a given identity, authorization is the process of determining whether that user can access a given resource, based on the user's privileges and any permissions or other access-control specifications that apply to the resource.
When access control checks are incorrectly applied, users are able to access data or perform actions that they should not be allowed to perform. This can lead to a wide range of problems, including information exposures, denial of service, and arbitrary code execution.
| https://cwe.mitre.org/data/definitions/863.html | 0 | Matthew Macy | 2020-08-18 09:57:07-07:00 | FreeBSD: Fix UNIX permissions checking
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10727 | 716b53d0a14c72bda16c0872565dd1909757e73f | False | openzfs/zfs | OpenZFS on Linux and FreeBSD | 2009-12-14 20:20:34 | 2022-08-27 19:30:11 | https://openzfs.github.io/openzfs-docs | openzfs | 8049.0 | 1493.0 | zfs_groupmember | zfs_groupmember( zfsvfs_t * zfsvfs , uint64_t id , cred_t * cr) | ['zfsvfs', 'id', 'cr'] | zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr)
{
#ifdef HAVE_KSID
ksid_t *ksid = crgetsid(cr, KSID_GROUP);
ksidlist_t *ksidlist = crgetsidlist(cr);
uid_t gid;
if (ksid && ksidlist) {
int i;
ksid_t *ksid_groups;
uint32_t idx = FUID_INDEX(id);
uint32_t rid = FUID_RID(id);
ksid_groups = ksidlist->ksl_sids;
for (i = 0; i != ksidlist->ksl_nsid; i++) {
if (idx == 0) {
if (id != IDMAP_WK_CREATOR_GROUP_GID &&
id == ksid_groups[i].ks_id) {
return (B_TRUE);
}
} else {
const char *domain;
domain = zfs_fuid_find_by_idx(zfsvfs, idx);
ASSERT(domain != NULL);
if (strcmp(domain,
IDMAP_WK_CREATOR_SID_AUTHORITY) == 0)
return (B_FALSE);
if ((strcmp(domain,
ksid_groups[i].ks_domain->kd_name) == 0) &&
rid == ksid_groups[i].ks_rid)
return (B_TRUE);
}
}
}
/*
* Not found in ksidlist, check posix groups
*/
gid = zfs_fuid_map_id(zfsvfs, id, cr, ZFS_GROUP);
return (groupmember(gid, cr));
#else
return (B_TRUE);
#endif
} | 224 | True | 1 |
CVE-2020-24717 | False | False | False | False | AV:L/AC:L/Au:N/C:C/I:C/A:C | LOCAL | LOW | NONE | COMPLETE | COMPLETE | COMPLETE | 7.2 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | HIGH | HIGH | HIGH | 7.8 | HIGH | 1.8 | 5.9 | False | [{'url': 'https://jira.ixsystems.com/browse/NAS-107270', 'name': 'https://jira.ixsystems.com/browse/NAS-107270', 'refsource': 'MISC', 'tags': ['Exploit', 'Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'name': 'https://github.com/openzfs/zfs/commit/716b53d0a14c72bda16c0872565dd1909757e73f', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://reviews.freebsd.org/D26107', 'name': 'https://reviews.freebsd.org/D26107', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Patch', 'Third Party Advisory']}, {'url': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'name': 'https://github.com/openzfs/zfs/compare/zfs-0.8.4...zfs-2.0.0-rc1', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-276'}]}] | HIGH | [{'operator': 'AND', 'children': [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:openzfs:openzfs:*:*:*:*:*:*:*:*', 'versionEndIncluding': '0.8.4', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': False, 'cpe23Uri': 'cpe:2.3:o:freebsd:freebsd:-:*:*:*:*:*:*:*', 'cpe_name': []}]}], 'cpe_match': []}] | [{'lang': 'en', 'value': 'OpenZFS before 2.0.0-rc1, when used on FreeBSD, misinterprets group permissions as user permissions, as demonstrated by mode 0770 being equivalent to mode 0777.'}] | 2020-09-04T16:20Z | 2020-08-27T19:15Z | Incorrect Default Permissions | During installation, installed file permissions are set to allow anyone to modify those files. | https://cwe.mitre.org/data/definitions/276.html | 0 | Matthew Macy | 2020-08-18 09:57:07-07:00 | FreeBSD: Fix UNIX permissions checking
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10727 | 716b53d0a14c72bda16c0872565dd1909757e73f | False | openzfs/zfs | OpenZFS on Linux and FreeBSD | 2009-12-14 20:20:34 | 2022-08-27 19:30:11 | https://openzfs.github.io/openzfs-docs | openzfs | 8049.0 | 1493.0 | zfs_groupmember | zfs_groupmember( zfsvfs_t * zfsvfs , uint64_t id , cred_t * cr) | ['zfsvfs', 'id', 'cr'] | zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr)
{
#ifdef HAVE_KSID
ksid_t *ksid = crgetsid(cr, KSID_GROUP);
ksidlist_t *ksidlist = crgetsidlist(cr);
uid_t gid;
if (ksid && ksidlist) {
int i;
ksid_t *ksid_groups;
uint32_t idx = FUID_INDEX(id);
uint32_t rid = FUID_RID(id);
ksid_groups = ksidlist->ksl_sids;
for (i = 0; i != ksidlist->ksl_nsid; i++) {
if (idx == 0) {
if (id != IDMAP_WK_CREATOR_GROUP_GID &&
id == ksid_groups[i].ks_id) {
return (B_TRUE);
}
} else {
const char *domain;
domain = zfs_fuid_find_by_idx(zfsvfs, idx);
ASSERT(domain != NULL);
if (strcmp(domain,
IDMAP_WK_CREATOR_SID_AUTHORITY) == 0)
return (B_FALSE);
if ((strcmp(domain,
ksid_groups[i].ks_domain->kd_name) == 0) &&
rid == ksid_groups[i].ks_rid)
return (B_TRUE);
}
}
}
/*
* Not found in ksidlist, check posix groups
*/
gid = zfs_fuid_map_id(zfsvfs, id, cr, ZFS_GROUP);
return (groupmember(gid, cr));
#else
return (B_TRUE);
#endif
} | 224 | True | 1 |
|
CVE-2020-26164 | False | False | False | False | AV:L/AC:L/Au:N/C:N/I:N/A:C | LOCAL | LOW | NONE | NONE | NONE | COMPLETE | 4.9 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | NONE | NONE | HIGH | 5.5 | MEDIUM | 1.8 | 3.6 | False | [{'url': 'https://github.com/KDE/kdeconnect-kde/commit/8112729eb0f13e6947984416118531078e65580d', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/8112729eb0f13e6947984416118531078e65580d', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/024e5f23db8d8ad3449714b906b46094baaffb89', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/024e5f23db8d8ad3449714b906b46094baaffb89', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://kdeconnect.kde.org/official/', 'name': 'https://kdeconnect.kde.org/official/', 'refsource': 'MISC', 'tags': ['Product']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/542d94a70c56aa386c8d4d793481ce181b0422e8', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/542d94a70c56aa386c8d4d793481ce181b0422e8', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/613899be24b6e2a6b3e5cc719efce8ae8a122991', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/613899be24b6e2a6b3e5cc719efce8ae8a122991', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugzilla.suse.com/show_bug.cgi?id=1176268', 'name': 'https://bugzilla.suse.com/show_bug.cgi?id=1176268', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/4fbd01a3d44a0bcca888c49a77ec7cfd10e113d7', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/4fbd01a3d44a0bcca888c49a77ec7cfd10e113d7', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://lists.opensuse.org/opensuse-security-announce/2020-10/msg00014.html', 'name': 'https://lists.opensuse.org/opensuse-security-announce/2020-10/msg00014.html', 'refsource': 'CONFIRM', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/releases', 'name': 'https://github.com/KDE/kdeconnect-kde/releases', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/ce0f00fc2d3eccb51d0af4eba61a4f60de086a59', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/ce0f00fc2d3eccb51d0af4eba61a4f60de086a59', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://kde.org/info/security/advisory-20201002-1.txt', 'name': 'https://kde.org/info/security/advisory-20201002-1.txt', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory', 'Vendor Advisory']}, {'url': 'http://lists.opensuse.org/opensuse-security-announce/2020-10/msg00016.html', 'name': 'openSUSE-SU-2020:1647', 'refsource': 'SUSE', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'http://lists.opensuse.org/opensuse-security-announce/2020-10/msg00018.html', 'name': 'openSUSE-SU-2020:1650', 'refsource': 'SUSE', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2020/10/13/4', 'name': '[oss-security] 20201013 kdeconnect: CVE-2020-26164: multiple security issues in kdeconnectd network daemon', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2020/10/13/5', 'name': '[oss-security] 20201013 Re: kdeconnect: CVE-2020-26164: multiple security issues in kdeconnectd network daemon', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2020/10/14/1', 'name': '[oss-security] 20201014 Re: kdeconnect: CVE-2020-26164: multiple security issues in kdeconnectd network daemon', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2020/11/30/1', 'name': '[oss-security] 20201130 Re: kdeconnect: CVE-2020-26164: multiple security issues in kdeconnectd network daemon', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://security.gentoo.org/glsa/202101-16', 'name': 'GLSA-202101-16', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-400'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:kde:kdeconnect:*:*:*:*:*:*:*:*', 'versionEndExcluding': '20.08.2', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:opensuse:backports_sle:15.0:sp1:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:opensuse:leap:15.2:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:opensuse:backports_sle:15.0:sp2:*:*:*:*:*:*', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'In kdeconnect-kde (aka KDE Connect) before 20.08.2, an attacker on the local network could send crafted packets that trigger use of large amounts of CPU, memory, or network connection slots, aka a Denial of Service attack.'}] | 2021-01-26T18:15Z | 2020-10-07T19:15Z | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. |
Limited resources include memory, file system storage, database connection pool entries, and CPU. If an attacker can trigger the allocation of these limited resources, but the number or size of the resources is not controlled, then the attacker could cause a denial of service that consumes all available resources. This would prevent valid users from accessing the software, and it could potentially have an impact on the surrounding environment. For example, a memory exhaustion attack against an application could slow down the application as well as its host operating system.
There are at least three distinct scenarios which can commonly lead to resource exhaustion:
Lack of throttling for the number of allocated resources
Losing all references to a resource before reaching the shutdown stage
Not closing/returning a resource after processing
Resource exhaustion problems are often result due to an incorrect implementation of the following situations:
Error conditions and other exceptional circumstances.
Confusion over which part of the program is responsible for releasing the resource.
| https://cwe.mitre.org/data/definitions/400.html | 0 | Aleix Pol | 2020-09-16 02:27:13+02:00 | Don't brute-force reading the socket
The package will arrive eventually, and dataReceived will be emitted.
Otherwise we just end up calling dataReceived to no end.
Thanks Matthias Gerstner <[email protected]> for reporting this. | 8112729eb0f13e6947984416118531078e65580d | False | KDE/kdeconnect-kde | Multi-platform app that allows your devices to communicate | 2015-09-18 13:58:52 | 2022-08-27 02:56:27 | https://invent.kde.org/network/kdeconnect-kde | KDE | 1530.0 | 138.0 | SocketLineReader::dataReceived | SocketLineReader::dataReceived() | [] | void SocketLineReader::dataReceived()
{
while (m_socket->canReadLine()) {
const QByteArray line = m_socket->readLine();
if (line.length() > 1) { //we don't want a single \n
m_packets.enqueue(line);
}
}
//If we still have things to read from the socket, call dataReceived again
//We do this manually because we do not trust readyRead to be emitted again
//So we call this method again just in case.
if (m_socket->bytesAvailable() > 0) {
QMetaObject::invokeMethod(this, "dataReceived", Qt::QueuedConnection);
return;
}
//If we have any packets, tell it to the world.
if (!m_packets.isEmpty()) {
Q_EMIT readyRead();
}
} | 89 | True | 1 |
CVE-2020-26164 | False | False | False | False | AV:L/AC:L/Au:N/C:N/I:N/A:C | LOCAL | LOW | NONE | NONE | NONE | COMPLETE | 4.9 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H | LOCAL | LOW | LOW | NONE | UNCHANGED | NONE | NONE | HIGH | 5.5 | MEDIUM | 1.8 | 3.6 | False | [{'url': 'https://github.com/KDE/kdeconnect-kde/commit/8112729eb0f13e6947984416118531078e65580d', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/8112729eb0f13e6947984416118531078e65580d', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/024e5f23db8d8ad3449714b906b46094baaffb89', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/024e5f23db8d8ad3449714b906b46094baaffb89', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://kdeconnect.kde.org/official/', 'name': 'https://kdeconnect.kde.org/official/', 'refsource': 'MISC', 'tags': ['Product']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/542d94a70c56aa386c8d4d793481ce181b0422e8', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/542d94a70c56aa386c8d4d793481ce181b0422e8', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/613899be24b6e2a6b3e5cc719efce8ae8a122991', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/613899be24b6e2a6b3e5cc719efce8ae8a122991', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://bugzilla.suse.com/show_bug.cgi?id=1176268', 'name': 'https://bugzilla.suse.com/show_bug.cgi?id=1176268', 'refsource': 'MISC', 'tags': ['Issue Tracking', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/4fbd01a3d44a0bcca888c49a77ec7cfd10e113d7', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/4fbd01a3d44a0bcca888c49a77ec7cfd10e113d7', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://lists.opensuse.org/opensuse-security-announce/2020-10/msg00014.html', 'name': 'https://lists.opensuse.org/opensuse-security-announce/2020-10/msg00014.html', 'refsource': 'CONFIRM', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/releases', 'name': 'https://github.com/KDE/kdeconnect-kde/releases', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/KDE/kdeconnect-kde/commit/ce0f00fc2d3eccb51d0af4eba61a4f60de086a59', 'name': 'https://github.com/KDE/kdeconnect-kde/commit/ce0f00fc2d3eccb51d0af4eba61a4f60de086a59', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://kde.org/info/security/advisory-20201002-1.txt', 'name': 'https://kde.org/info/security/advisory-20201002-1.txt', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory', 'Vendor Advisory']}, {'url': 'http://lists.opensuse.org/opensuse-security-announce/2020-10/msg00016.html', 'name': 'openSUSE-SU-2020:1647', 'refsource': 'SUSE', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'http://lists.opensuse.org/opensuse-security-announce/2020-10/msg00018.html', 'name': 'openSUSE-SU-2020:1650', 'refsource': 'SUSE', 'tags': ['Mailing List', 'Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2020/10/13/4', 'name': '[oss-security] 20201013 kdeconnect: CVE-2020-26164: multiple security issues in kdeconnectd network daemon', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2020/10/13/5', 'name': '[oss-security] 20201013 Re: kdeconnect: CVE-2020-26164: multiple security issues in kdeconnectd network daemon', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2020/10/14/1', 'name': '[oss-security] 20201014 Re: kdeconnect: CVE-2020-26164: multiple security issues in kdeconnectd network daemon', 'refsource': 'MLIST', 'tags': ['Third Party Advisory']}, {'url': 'http://www.openwall.com/lists/oss-security/2020/11/30/1', 'name': '[oss-security] 20201130 Re: kdeconnect: CVE-2020-26164: multiple security issues in kdeconnectd network daemon', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://security.gentoo.org/glsa/202101-16', 'name': 'GLSA-202101-16', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-400'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:kde:kdeconnect:*:*:*:*:*:*:*:*', 'versionEndExcluding': '20.08.2', 'cpe_name': []}]}, {'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:opensuse:backports_sle:15.0:sp1:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:o:opensuse:leap:15.2:*:*:*:*:*:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:opensuse:backports_sle:15.0:sp2:*:*:*:*:*:*', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'In kdeconnect-kde (aka KDE Connect) before 20.08.2, an attacker on the local network could send crafted packets that trigger use of large amounts of CPU, memory, or network connection slots, aka a Denial of Service attack.'}] | 2021-01-26T18:15Z | 2020-10-07T19:15Z | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. |
Limited resources include memory, file system storage, database connection pool entries, and CPU. If an attacker can trigger the allocation of these limited resources, but the number or size of the resources is not controlled, then the attacker could cause a denial of service that consumes all available resources. This would prevent valid users from accessing the software, and it could potentially have an impact on the surrounding environment. For example, a memory exhaustion attack against an application could slow down the application as well as its host operating system.
There are at least three distinct scenarios which can commonly lead to resource exhaustion:
Lack of throttling for the number of allocated resources
Losing all references to a resource before reaching the shutdown stage
Not closing/returning a resource after processing
Resource exhaustion problems are often result due to an incorrect implementation of the following situations:
Error conditions and other exceptional circumstances.
Confusion over which part of the program is responsible for releasing the resource.
| https://cwe.mitre.org/data/definitions/400.html | 0 | Aleix Pol | 2020-09-16 02:27:13+02:00 | Don't brute-force reading the socket
The package will arrive eventually, and dataReceived will be emitted.
Otherwise we just end up calling dataReceived to no end.
Thanks Matthias Gerstner <[email protected]> for reporting this. | 8112729eb0f13e6947984416118531078e65580d | False | KDE/kdeconnect-kde | Multi-platform app that allows your devices to communicate | 2015-09-18 13:58:52 | 2022-08-27 02:56:27 | https://invent.kde.org/network/kdeconnect-kde | KDE | 1530.0 | 138.0 | TestSocketLineReader::initTestCase | TestSocketLineReader::initTestCase() | [] | void TestSocketLineReader::initTestCase()
{
m_server = new Server(this);
QVERIFY2(m_server->listen(QHostAddress::LocalHost, 8694), "Failed to create local tcp server");
m_timer.setInterval(4000);//For second is more enough to send some data via local socket
m_timer.setSingleShot(true);
connect(&m_timer, &QTimer::timeout, &m_loop, &QEventLoop::quit);
m_conn = new QSslSocket(this);
m_conn->connectToHost(QHostAddress::LocalHost, 8694);
connect(m_conn, &QAbstractSocket::connected, &m_loop, &QEventLoop::quit);
m_timer.start();
m_loop.exec();
QVERIFY2(m_conn->isOpen(), "Could not connect to local tcp server");
} | 124 | True | 1 |
CVE-2020-26208 | False | False | False | True | AV:N/AC:M/Au:N/C:P/I:N/A:P | NETWORK | MEDIUM | NONE | PARTIAL | NONE | PARTIAL | 5.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H | LOCAL | LOW | NONE | REQUIRED | UNCHANGED | LOW | NONE | HIGH | 6.1 | MEDIUM | 1.8 | 4.2 | False | [{'url': 'https://bugs.launchpad.net/ubuntu/+source/jhead/+bug/1900821', 'name': 'https://bugs.launchpad.net/ubuntu/+source/jhead/+bug/1900821', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/Matthias-Wandel/jhead/issues/7', 'name': 'https://github.com/Matthias-Wandel/jhead/issues/7', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/F-ZhaoYang/jhead/commit/5186ddcf9e35a7aa0ff0539489a930434a1325f4', 'name': 'https://github.com/F-ZhaoYang/jhead/commit/5186ddcf9e35a7aa0ff0539489a930434a1325f4', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/F-ZhaoYang/jhead/security/advisories/GHSA-7pr6-xq4f-qhgc', 'name': 'https://github.com/F-ZhaoYang/jhead/security/advisories/GHSA-7pr6-xq4f-qhgc', 'refsource': 'CONFIRM', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-787'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jhead_project:jhead:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.04', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'JHEAD is a simple command line tool for displaying and some manipulation of EXIF header data embedded in Jpeg images from digital cameras. In affected versions there is a heap-buffer-overflow on jhead-3.04/jpgfile.c:285 ReadJpegSections. Crafted jpeg images can be provided to the user resulting in a program crash or potentially incorrect exif information retrieval. Users are advised to upgrade. There is no known workaround for this issue.'}] | 2022-02-07T15:54Z | 2022-02-02T12:15Z | Out-of-bounds Write | The software writes data past the end, or before the beginning, of the intended buffer. | Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
| https://cwe.mitre.org/data/definitions/787.html | 0 | Matthias | 2020-10-23 10:17:20-03:00 | Just allocate 20 bytes extra at the end of a section. Otherwise, we end
up with a whole lot of little checks for structures that the file says
are there but are unexpectedly cut off in fuzz tests | 5186ddcf9e35a7aa0ff0539489a930434a1325f4 | False | F-ZhaoYang/jhead | null | 2020-10-30 07:57:40 | 2020-10-28 13:13:46 | null | F-ZhaoYang | 0.0 | 0.0 | ReadJpegSections | ReadJpegSections( FILE * infile , ReadMode_t ReadMode) | ['infile', 'ReadMode'] | int ReadJpegSections (FILE * infile, ReadMode_t ReadMode)
{
int a;
int HaveCom = FALSE;
a = fgetc(infile);
if (a != 0xff || fgetc(infile) != M_SOI){
return FALSE;
}
ImageInfo.JfifHeader.XDensity = ImageInfo.JfifHeader.YDensity = 300;
ImageInfo.JfifHeader.ResolutionUnits = 1;
for(;;){
int itemlen;
int prev;
int marker = 0;
int ll,lh, got;
uchar * Data;
CheckSectionsAllocated();
prev = 0;
for (a=0;;a++){
marker = fgetc(infile);
if (marker != 0xff && prev == 0xff) break;
if (marker == EOF){
ErrFatal("Unexpected end of file");
}
prev = marker;
}
if (a > 10){
ErrNonfatal("Extraneous %d padding bytes before section %02X",a-1,marker);
}
Sections[SectionsRead].Type = marker;
// Read the length of the section.
lh = fgetc(infile);
ll = fgetc(infile);
if (lh == EOF || ll == EOF){
ErrFatal("Unexpected end of file");
}
itemlen = (lh << 8) | ll;
if (itemlen < 2){
ErrFatal("invalid marker");
}
Sections[SectionsRead].Size = itemlen;
Data = (uchar *)malloc(itemlen);
if (Data == NULL){
ErrFatal("Could not allocate memory");
}
Sections[SectionsRead].Data = Data;
// Store first two pre-read bytes.
Data[0] = (uchar)lh;
Data[1] = (uchar)ll;
got = fread(Data+2, 1, itemlen-2, infile); // Read the whole section.
if (got != itemlen-2){
ErrFatal("Premature end of file?");
}
SectionsRead += 1;
switch(marker){
case M_SOS: // stop before hitting compressed data
// If reading entire image is requested, read the rest of the data.
if (ReadMode & READ_IMAGE){
int cp, ep, size;
// Determine how much file is left.
cp = ftell(infile);
fseek(infile, 0, SEEK_END);
ep = ftell(infile);
fseek(infile, cp, SEEK_SET);
size = ep-cp;
Data = (uchar *)malloc(size);
if (Data == NULL){
ErrFatal("could not allocate data for entire image");
}
got = fread(Data, 1, size, infile);
if (got != size){
ErrFatal("could not read the rest of the image");
}
CheckSectionsAllocated();
Sections[SectionsRead].Data = Data;
Sections[SectionsRead].Size = size;
Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER;
SectionsRead ++;
HaveAll = 1;
}
return TRUE;
case M_DQT:
// Use for jpeg quality guessing
process_DQT(Data, itemlen);
break;
case M_DHT:
// Use for jpeg quality guessing
process_DHT(Data, itemlen);
break;
case M_EOI: // in case it's a tables-only JPEG stream
fprintf(stderr,"No image in jpeg!\n");
return FALSE;
case M_COM: // Comment section
if (HaveCom || ((ReadMode & READ_METADATA) == 0)){
// Discard this section.
free(Sections[--SectionsRead].Data);
}else{
process_COM(Data, itemlen);
HaveCom = TRUE;
}
break;
case M_JFIF:
// Regular jpegs always have this tag, exif images have the exif
// marker instead, althogh ACDsee will write images with both markers.
// this program will re-create this marker on absence of exif marker.
// hence no need to keep the copy from the file.
if (itemlen < 16){
fprintf(stderr,"Jfif header too short\n");
goto ignore;
}
if (memcmp(Data+2, "JFIF\0",5)){
fprintf(stderr,"Header missing JFIF marker\n");
}
ImageInfo.JfifHeader.Present = TRUE;
ImageInfo.JfifHeader.ResolutionUnits = Data[9];
ImageInfo.JfifHeader.XDensity = (Data[10]<<8) | Data[11];
ImageInfo.JfifHeader.YDensity = (Data[12]<<8) | Data[13];
if (ShowTags){
printf("JFIF SOI marker: Units: %d ",ImageInfo.JfifHeader.ResolutionUnits);
switch(ImageInfo.JfifHeader.ResolutionUnits){
case 0: printf("(aspect ratio)"); break;
case 1: printf("(dots per inch)"); break;
case 2: printf("(dots per cm)"); break;
default: printf("(unknown)"); break;
}
printf(" X-density=%d Y-density=%d\n",ImageInfo.JfifHeader.XDensity, ImageInfo.JfifHeader.YDensity);
if (Data[14] || Data[15]){
fprintf(stderr,"Ignoring jfif header thumbnail\n");
}
}
ignore:
free(Sections[--SectionsRead].Data);
break;
case M_EXIF:
// There can be different section using the same marker.
if (ReadMode & READ_METADATA){
if (memcmp(Data+2, "Exif", 4) == 0){
process_EXIF(Data, itemlen);
break;
}else if (memcmp(Data+2, "http:", 5) == 0){
Sections[SectionsRead-1].Type = M_XMP; // Change tag for internal purposes.
if (ShowTags){
printf("Image contains XMP section, %d bytes long\n", itemlen);
if (ShowTags){
ShowXmp(Sections[SectionsRead-1]);
}
}
break;
}
}
// Oterwise, discard this section.
free(Sections[--SectionsRead].Data);
break;
case M_IPTC:
if (ReadMode & READ_METADATA){
if (ShowTags){
printf("Image contains IPTC section, %d bytes long\n", itemlen);
}
// Note: We just store the IPTC section. Its relatively straightforward
// and we don't act on any part of it, so just display it at parse time.
}else{
free(Sections[--SectionsRead].Data);
}
break;
case M_SOF0:
case M_SOF1:
case M_SOF2:
case M_SOF3:
case M_SOF5:
case M_SOF6:
case M_SOF7:
case M_SOF9:
case M_SOF10:
case M_SOF11:
case M_SOF13:
case M_SOF14:
case M_SOF15:
if (itemlen < 8){
fprintf(stderr,"Section too short\n");
break;
}
process_SOFn(Data, marker);
break;
default:
// Skip any other sections.
if (ShowTags){
printf("Jpeg section marker 0x%02x size %d\n",marker, itemlen);
}
break;
}
}
return TRUE;
}
| 1028 | True | 1 |
CVE-2020-26208 | False | False | False | True | AV:N/AC:M/Au:N/C:P/I:N/A:P | NETWORK | MEDIUM | NONE | PARTIAL | NONE | PARTIAL | 5.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H | LOCAL | LOW | NONE | REQUIRED | UNCHANGED | LOW | NONE | HIGH | 6.1 | MEDIUM | 1.8 | 4.2 | False | [{'url': 'https://bugs.launchpad.net/ubuntu/+source/jhead/+bug/1900821', 'name': 'https://bugs.launchpad.net/ubuntu/+source/jhead/+bug/1900821', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://github.com/Matthias-Wandel/jhead/issues/7', 'name': 'https://github.com/Matthias-Wandel/jhead/issues/7', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/F-ZhaoYang/jhead/commit/5186ddcf9e35a7aa0ff0539489a930434a1325f4', 'name': 'https://github.com/F-ZhaoYang/jhead/commit/5186ddcf9e35a7aa0ff0539489a930434a1325f4', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/F-ZhaoYang/jhead/security/advisories/GHSA-7pr6-xq4f-qhgc', 'name': 'https://github.com/F-ZhaoYang/jhead/security/advisories/GHSA-7pr6-xq4f-qhgc', 'refsource': 'CONFIRM', 'tags': ['Exploit', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-787'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:jhead_project:jhead:*:*:*:*:*:*:*:*', 'versionEndExcluding': '3.04', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'JHEAD is a simple command line tool for displaying and some manipulation of EXIF header data embedded in Jpeg images from digital cameras. In affected versions there is a heap-buffer-overflow on jhead-3.04/jpgfile.c:285 ReadJpegSections. Crafted jpeg images can be provided to the user resulting in a program crash or potentially incorrect exif information retrieval. Users are advised to upgrade. There is no known workaround for this issue.'}] | 2022-02-07T15:54Z | 2022-02-02T12:15Z | Out-of-bounds Write | The software writes data past the end, or before the beginning, of the intended buffer. | Typically, this can result in corruption of data, a crash, or code execution. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent write operation then produces undefined or unexpected results.
| https://cwe.mitre.org/data/definitions/787.html | 0 | Matthias | 2020-10-23 10:17:20-03:00 | Just allocate 20 bytes extra at the end of a section. Otherwise, we end
up with a whole lot of little checks for structures that the file says
are there but are unexpectedly cut off in fuzz tests | 5186ddcf9e35a7aa0ff0539489a930434a1325f4 | False | F-ZhaoYang/jhead | null | 2020-10-30 07:57:40 | 2020-10-28 13:13:46 | null | F-ZhaoYang | 0.0 | 0.0 | ReplaceThumbnail | ReplaceThumbnail( const char * ThumbFileName) | ['ThumbFileName'] | int ReplaceThumbnail(const char * ThumbFileName)
{
FILE * ThumbnailFile;
int ThumbLen, NewExifSize;
Section_t * ExifSection;
uchar * ThumbnailPointer;
if (ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailAtEnd == FALSE){
if (ThumbFileName == NULL){
// Delete of nonexistent thumbnail (not even pointers present)
// No action, no error.
return FALSE;
}
// Adding or removing of thumbnail is not possible - that would require rearranging
// of the exif header, which is risky, and jhad doesn't know how to do.
fprintf(stderr,"Image contains no thumbnail to replace - add is not possible\n");
return FALSE;
}
if (ThumbFileName){
ThumbnailFile = fopen(ThumbFileName,"rb");
if (ThumbnailFile == NULL){
noread:
ErrFatal("Could not read thumbnail file");
return FALSE;
}
// get length
fseek(ThumbnailFile, 0, SEEK_END);
ThumbLen = ftell(ThumbnailFile);
fseek(ThumbnailFile, 0, SEEK_SET);
if (ThumbLen + ImageInfo.ThumbnailOffset > 0x10000-20){
ErrFatal("Thumbnail is too large to insert into exif header");
}
}else{
if (ImageInfo.ThumbnailSize == 0){
return FALSE;
}
ThumbLen = 0;
ThumbnailFile = NULL;
}
ExifSection = FindSection(M_EXIF);
NewExifSize = ImageInfo.ThumbnailOffset+8+ThumbLen;
ExifSection->Data = (uchar *)realloc(ExifSection->Data, NewExifSize);
ThumbnailPointer = ExifSection->Data+ImageInfo.ThumbnailOffset+8;
if (ThumbnailFile){
if (fread(ThumbnailPointer, 1, ThumbLen, ThumbnailFile) != ThumbLen){
goto noread;
}
fclose(ThumbnailFile);
}
ImageInfo.ThumbnailSize = ThumbLen;
Put32u(ExifSection->Data+ImageInfo.ThumbnailSizeOffset+8, ThumbLen);
ExifSection->Data[0] = (uchar)(NewExifSize >> 8);
ExifSection->Data[1] = (uchar)NewExifSize;
ExifSection->Size = NewExifSize;
return TRUE;
}
| 300 | True | 1 |
CVE-2020-5235 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/nanopb/nanopb/commit/45582f1f97f49e2abfdba1463d1e1027682d9856', 'name': 'https://github.com/nanopb/nanopb/commit/45582f1f97f49e2abfdba1463d1e1027682d9856', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/nanopb/nanopb/commit/7b396821ddd06df8e39143f16e1dc0a4645b89a3', 'name': 'https://github.com/nanopb/nanopb/commit/7b396821ddd06df8e39143f16e1dc0a4645b89a3', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/nanopb/nanopb/security/advisories/GHSA-gcx3-7m76-287p', 'name': 'https://github.com/nanopb/nanopb/security/advisories/GHSA-gcx3-7m76-287p', 'refsource': 'CONFIRM', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/nanopb/nanopb/commit/aa9d0d1ca78d6adec3adfeecf3a706c7f9df81f2', 'name': 'https://github.com/nanopb/nanopb/commit/aa9d0d1ca78d6adec3adfeecf3a706c7f9df81f2', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-125'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nanopb_project:nanopb:*:*:*:*:*:*:*:*', 'versionEndExcluding': '0.2.9.4', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nanopb_project:nanopb:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.3.0', 'versionEndExcluding': '0.3.9.5', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nanopb_project:nanopb:*:*:*:*:*:*:*:*', 'versionStartIncluding': '0.4.0', 'versionEndExcluding': '0.4.1', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'There is a potentially exploitable out of memory condition In Nanopb before 0.4.1, 0.3.9.5, and 0.2.9.4. When nanopb is compiled with PB_ENABLE_MALLOC, the message to be decoded contains a repeated string, bytes or message field and realloc() runs out of memory when expanding the array nanopb can end up calling `free()` on a pointer value that comes from uninitialized memory. Depending on platform this can result in a crash or further memory corruption, which may be exploitable in some cases. This problem is fixed in nanopb-0.4.1, nanopb-0.3.9.5, nanopb-0.2.9.4.'}] | 2020-02-06T18:51Z | 2020-02-04T03:15Z | Out-of-bounds Read | The software reads data past the end, or before the beginning, of the intended buffer. | Typically, this can allow attackers to read sensitive information from other memory locations or cause a crash. A crash can occur when the code reads a variable amount of data and assumes that a sentinel exists to stop the read operation, such as a NUL in a string. The expected sentinel might not be located in the out-of-bounds memory, causing excessive data to be read, leading to a segmentation fault or a buffer overflow. The software may modify an index or perform pointer arithmetic that references a memory location that is outside of the boundaries of the buffer. A subsequent read operation then produces undefined or unexpected results.
| https://cwe.mitre.org/data/definitions/125.html | 0 | Petteri Aimonen | 2020-02-01 18:40:45+02:00 | Fix invalid free() after failed realloc() (GHSA-gcx3-7m76-287p) | 45582f1f97f49e2abfdba1463d1e1027682d9856 | False | nanopb/nanopb | Protocol Buffers with small code size | 2015-04-29 17:21:37 | 2022-08-24 14:38:42 | https://jpa.kapsi.fi/nanopb/ | nanopb | 3057.0 | 674.0 | decode_pointer_field | decode_pointer_field( pb_istream_t * stream , pb_wire_type_t wire_type , pb_field_iter_t * field) | ['stream', 'wire_type', 'field'] | static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field)
{
#ifndef PB_ENABLE_MALLOC
PB_UNUSED(wire_type);
PB_UNUSED(field);
PB_RETURN_ERROR(stream, "no malloc support");
#else
switch (PB_HTYPE(field->type))
{
case PB_HTYPE_REQUIRED:
case PB_HTYPE_OPTIONAL:
case PB_HTYPE_ONEOF:
if (!check_wire_type(wire_type, field))
PB_RETURN_ERROR(stream, "wrong wire type");
if (PB_LTYPE_IS_SUBMSG(field->type) && *(void**)field->pField != NULL)
{
/* Duplicate field, have to release the old allocation first. */
/* FIXME: Does this work correctly for oneofs? */
pb_release_single_field(field);
}
if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
{
*(pb_size_t*)field->pSize = field->tag;
}
if (PB_LTYPE(field->type) == PB_LTYPE_STRING ||
PB_LTYPE(field->type) == PB_LTYPE_BYTES)
{
/* pb_dec_string and pb_dec_bytes handle allocation themselves */
field->pData = field->pField;
return decode_basic_field(stream, field);
}
else
{
if (!allocate_field(stream, field->pField, field->data_size, 1))
return false;
field->pData = *(void**)field->pField;
initialize_pointer_field(field->pData, field);
return decode_basic_field(stream, field);
}
case PB_HTYPE_REPEATED:
if (wire_type == PB_WT_STRING
&& PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
{
/* Packed array, multiple items come in at once. */
bool status = true;
pb_size_t *size = (pb_size_t*)field->pSize;
size_t allocated_size = *size;
pb_istream_t substream;
if (!pb_make_string_substream(stream, &substream))
return false;
while (substream.bytes_left)
{
if ((size_t)*size + 1 > allocated_size)
{
/* Allocate more storage. This tries to guess the
* number of remaining entries. Round the division
* upwards. */
allocated_size += (substream.bytes_left - 1) / field->data_size + 1;
if (!allocate_field(&substream, field->pField, field->data_size, allocated_size))
{
status = false;
break;
}
}
/* Decode the array entry */
field->pData = *(char**)field->pField + field->data_size * (*size);
initialize_pointer_field(field->pData, field);
if (!decode_basic_field(&substream, field))
{
status = false;
break;
}
if (*size == PB_SIZE_MAX)
{
#ifndef PB_NO_ERRMSG
stream->errmsg = "too many array entries";
#endif
status = false;
break;
}
(*size)++;
}
if (!pb_close_string_substream(stream, &substream))
return false;
return status;
}
else
{
/* Normal repeated field, i.e. only one item at a time. */
pb_size_t *size = (pb_size_t*)field->pSize;
if (*size == PB_SIZE_MAX)
PB_RETURN_ERROR(stream, "too many array entries");
if (!check_wire_type(wire_type, field))
PB_RETURN_ERROR(stream, "wrong wire type");
(*size)++;
if (!allocate_field(stream, field->pField, field->data_size, *size))
return false;
field->pData = *(char**)field->pField + field->data_size * (*size - 1);
initialize_pointer_field(field->pData, field);
return decode_basic_field(stream, field);
}
default:
PB_RETURN_ERROR(stream, "invalid field type");
}
#endif
} | 557 | True | 1 |
CVE-2020-26247 | False | False | False | False | AV:N/AC:L/Au:S/C:P/I:N/A:N | NETWORK | LOW | SINGLE | PARTIAL | NONE | NONE | 4.0 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | NETWORK | LOW | LOW | NONE | UNCHANGED | LOW | NONE | NONE | 4.3 | MEDIUM | 2.8 | 1.4 | False | [{'url': 'https://rubygems.org/gems/nokogiri', 'name': 'https://rubygems.org/gems/nokogiri', 'refsource': 'MISC', 'tags': ['Product', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'name': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'name': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'refsource': 'CONFIRM', 'tags': ['Mitigation', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'name': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://hackerone.com/reports/747489', 'name': 'https://hackerone.com/reports/747489', 'refsource': 'MISC', 'tags': ['Permissions Required']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/06/msg00007.html', 'name': '[debian-lts-announce] 20210606 [SECURITY] [DLA 2678-1] ruby-nokogiri security update', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://security.gentoo.org/glsa/202208-29', 'name': 'GLSA-202208-29', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-611'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '1.11.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc1:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc2:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc3:*:*:*:ruby:*:*', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.'}] | 2022-08-15T11:15Z | 2020-12-30T19:15Z | Improper Restriction of XML External Entity Reference | The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. |
XML documents optionally contain a Document Type Definition (DTD), which, among other features, enables the definition of XML entities. It is possible to define an entity by providing a substitution string in the form of a URI. The XML parser can access the contents of this URI and embed these contents back into the XML document for further processing.
By submitting an XML file that defines an external entity with a file:// URI, an attacker can cause the processing application to read the contents of a local file. For example, a URI such as "file:///c:/winnt/win.ini" designates (in Windows) the file C:\Winnt\win.ini, or file:///etc/passwd designates the password file in Unix-based systems. Using URIs with other schemes such as http://, the attacker can force the application to make outgoing requests to servers that the attacker cannot reach directly, which can be used to bypass firewall restrictions or hide the source of attacks such as port scanning.
Once the content of the URI is read, it is fed back into the application that is processing the XML. This application may echo back the data (e.g. in an error message), thereby exposing the file contents.
| https://cwe.mitre.org/data/definitions/611.html | 0 | Mike Dalessio | 2020-11-23 00:47:02-05:00 | feat: XML::Schema and RelaxNG creation accept optional ParseOptions
I'm trying out a new pattern, which is that the parsed object carries
around the ParseOptions it was created with, which should make some
testing a bit easier.
I'm also not implementing the "config block" pattern in use for
Documents, because I think the UX is weird and I'm hoping to change
everything to use kwargs in a 2.0 release, anyway. | 9c87439d9afa14a365ff13e73adc809cb2c3d97b | False | sparklemotion/nokogiri | Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. | 2008-07-14 15:34:32 | 2022-08-27 18:37:30 | https://nokogiri.org/ | sparklemotion | 5886.0 | 885.0 | from_document | from_document( VALUE klass , VALUE document) | ['klass', 'document'] | static VALUE from_document(VALUE klass, VALUE document)
{
xmlDocPtr doc;
xmlRelaxNGParserCtxtPtr ctx;
xmlRelaxNGPtr schema;
VALUE errors;
VALUE rb_schema;
Data_Get_Struct(document, xmlDoc, doc);
/* In case someone passes us a node. ugh. */
doc = doc->doc;
ctx = xmlRelaxNGNewDocParserCtxt(doc);
errors = rb_ary_new();
xmlSetStructuredErrorFunc((void *)errors, Nokogiri_error_array_pusher);
#ifdef HAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS
xmlRelaxNGSetParserStructuredErrors(
ctx,
Nokogiri_error_array_pusher,
(void *)errors
);
#endif
schema = xmlRelaxNGParse(ctx);
xmlSetStructuredErrorFunc(NULL, NULL);
xmlRelaxNGFreeParserCtxt(ctx);
if(NULL == schema) {
xmlErrorPtr error = xmlGetLastError();
if(error)
Nokogiri_error_raise(NULL, error);
else
rb_raise(rb_eRuntimeError, "Could not parse document");
return Qnil;
}
rb_schema = Data_Wrap_Struct(klass, 0, dealloc, schema);
rb_iv_set(rb_schema, "@errors", errors);
return rb_schema;
} | 158 | True | 1 |
CVE-2020-26247 | False | False | False | False | AV:N/AC:L/Au:S/C:P/I:N/A:N | NETWORK | LOW | SINGLE | PARTIAL | NONE | NONE | 4.0 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | NETWORK | LOW | LOW | NONE | UNCHANGED | LOW | NONE | NONE | 4.3 | MEDIUM | 2.8 | 1.4 | False | [{'url': 'https://rubygems.org/gems/nokogiri', 'name': 'https://rubygems.org/gems/nokogiri', 'refsource': 'MISC', 'tags': ['Product', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'name': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'name': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'refsource': 'CONFIRM', 'tags': ['Mitigation', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'name': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://hackerone.com/reports/747489', 'name': 'https://hackerone.com/reports/747489', 'refsource': 'MISC', 'tags': ['Permissions Required']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/06/msg00007.html', 'name': '[debian-lts-announce] 20210606 [SECURITY] [DLA 2678-1] ruby-nokogiri security update', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://security.gentoo.org/glsa/202208-29', 'name': 'GLSA-202208-29', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-611'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '1.11.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc1:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc2:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc3:*:*:*:ruby:*:*', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.'}] | 2022-08-15T11:15Z | 2020-12-30T19:15Z | Improper Restriction of XML External Entity Reference | The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. |
XML documents optionally contain a Document Type Definition (DTD), which, among other features, enables the definition of XML entities. It is possible to define an entity by providing a substitution string in the form of a URI. The XML parser can access the contents of this URI and embed these contents back into the XML document for further processing.
By submitting an XML file that defines an external entity with a file:// URI, an attacker can cause the processing application to read the contents of a local file. For example, a URI such as "file:///c:/winnt/win.ini" designates (in Windows) the file C:\Winnt\win.ini, or file:///etc/passwd designates the password file in Unix-based systems. Using URIs with other schemes such as http://, the attacker can force the application to make outgoing requests to servers that the attacker cannot reach directly, which can be used to bypass firewall restrictions or hide the source of attacks such as port scanning.
Once the content of the URI is read, it is fed back into the application that is processing the XML. This application may echo back the data (e.g. in an error message), thereby exposing the file contents.
| https://cwe.mitre.org/data/definitions/611.html | 0 | Mike Dalessio | 2020-11-23 00:47:02-05:00 | feat: XML::Schema and RelaxNG creation accept optional ParseOptions
I'm trying out a new pattern, which is that the parsed object carries
around the ParseOptions it was created with, which should make some
testing a bit easier.
I'm also not implementing the "config block" pattern in use for
Documents, because I think the UX is weird and I'm hoping to change
everything to use kwargs in a 2.0 release, anyway. | 9c87439d9afa14a365ff13e73adc809cb2c3d97b | False | sparklemotion/nokogiri | Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. | 2008-07-14 15:34:32 | 2022-08-27 18:37:30 | https://nokogiri.org/ | sparklemotion | 5886.0 | 885.0 | init_xml_relax_ng | init_xml_relax_ng() | [] | void init_xml_relax_ng()
{
VALUE nokogiri = rb_define_module("Nokogiri");
VALUE xml = rb_define_module_under(nokogiri, "XML");
VALUE klass = rb_define_class_under(xml, "RelaxNG", cNokogiriXmlSchema);
cNokogiriXmlRelaxNG = klass;
rb_define_singleton_method(klass, "read_memory", read_memory, 1);
rb_define_singleton_method(klass, "from_document", from_document, 1);
rb_define_private_method(klass, "validate_document", validate_document, 1);
} | 72 | True | 1 |
CVE-2020-26247 | False | False | False | False | AV:N/AC:L/Au:S/C:P/I:N/A:N | NETWORK | LOW | SINGLE | PARTIAL | NONE | NONE | 4.0 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | NETWORK | LOW | LOW | NONE | UNCHANGED | LOW | NONE | NONE | 4.3 | MEDIUM | 2.8 | 1.4 | False | [{'url': 'https://rubygems.org/gems/nokogiri', 'name': 'https://rubygems.org/gems/nokogiri', 'refsource': 'MISC', 'tags': ['Product', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'name': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'name': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'refsource': 'CONFIRM', 'tags': ['Mitigation', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'name': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://hackerone.com/reports/747489', 'name': 'https://hackerone.com/reports/747489', 'refsource': 'MISC', 'tags': ['Permissions Required']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/06/msg00007.html', 'name': '[debian-lts-announce] 20210606 [SECURITY] [DLA 2678-1] ruby-nokogiri security update', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://security.gentoo.org/glsa/202208-29', 'name': 'GLSA-202208-29', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-611'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '1.11.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc1:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc2:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc3:*:*:*:ruby:*:*', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.'}] | 2022-08-15T11:15Z | 2020-12-30T19:15Z | Improper Restriction of XML External Entity Reference | The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. |
XML documents optionally contain a Document Type Definition (DTD), which, among other features, enables the definition of XML entities. It is possible to define an entity by providing a substitution string in the form of a URI. The XML parser can access the contents of this URI and embed these contents back into the XML document for further processing.
By submitting an XML file that defines an external entity with a file:// URI, an attacker can cause the processing application to read the contents of a local file. For example, a URI such as "file:///c:/winnt/win.ini" designates (in Windows) the file C:\Winnt\win.ini, or file:///etc/passwd designates the password file in Unix-based systems. Using URIs with other schemes such as http://, the attacker can force the application to make outgoing requests to servers that the attacker cannot reach directly, which can be used to bypass firewall restrictions or hide the source of attacks such as port scanning.
Once the content of the URI is read, it is fed back into the application that is processing the XML. This application may echo back the data (e.g. in an error message), thereby exposing the file contents.
| https://cwe.mitre.org/data/definitions/611.html | 0 | Mike Dalessio | 2020-11-23 00:47:02-05:00 | feat: XML::Schema and RelaxNG creation accept optional ParseOptions
I'm trying out a new pattern, which is that the parsed object carries
around the ParseOptions it was created with, which should make some
testing a bit easier.
I'm also not implementing the "config block" pattern in use for
Documents, because I think the UX is weird and I'm hoping to change
everything to use kwargs in a 2.0 release, anyway. | 9c87439d9afa14a365ff13e73adc809cb2c3d97b | False | sparklemotion/nokogiri | Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. | 2008-07-14 15:34:32 | 2022-08-27 18:37:30 | https://nokogiri.org/ | sparklemotion | 5886.0 | 885.0 | read_memory | read_memory( VALUE klass , VALUE content) | ['klass', 'content'] | static VALUE read_memory(VALUE klass, VALUE content)
{
xmlRelaxNGParserCtxtPtr ctx = xmlRelaxNGNewMemParserCtxt(
(const char *)StringValuePtr(content),
(int)RSTRING_LEN(content)
);
xmlRelaxNGPtr schema;
VALUE errors = rb_ary_new();
VALUE rb_schema;
xmlSetStructuredErrorFunc((void *)errors, Nokogiri_error_array_pusher);
#ifdef HAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS
xmlRelaxNGSetParserStructuredErrors(
ctx,
Nokogiri_error_array_pusher,
(void *)errors
);
#endif
schema = xmlRelaxNGParse(ctx);
xmlSetStructuredErrorFunc(NULL, NULL);
xmlRelaxNGFreeParserCtxt(ctx);
if(NULL == schema) {
xmlErrorPtr error = xmlGetLastError();
if(error)
Nokogiri_error_raise(NULL, error);
else
rb_raise(rb_eRuntimeError, "Could not parse document");
return Qnil;
}
rb_schema = Data_Wrap_Struct(klass, 0, dealloc, schema);
rb_iv_set(rb_schema, "@errors", errors);
return rb_schema;
} | 152 | True | 1 |
CVE-2020-26247 | False | False | False | False | AV:N/AC:L/Au:S/C:P/I:N/A:N | NETWORK | LOW | SINGLE | PARTIAL | NONE | NONE | 4.0 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | NETWORK | LOW | LOW | NONE | UNCHANGED | LOW | NONE | NONE | 4.3 | MEDIUM | 2.8 | 1.4 | False | [{'url': 'https://rubygems.org/gems/nokogiri', 'name': 'https://rubygems.org/gems/nokogiri', 'refsource': 'MISC', 'tags': ['Product', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'name': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'name': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'refsource': 'CONFIRM', 'tags': ['Mitigation', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'name': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://hackerone.com/reports/747489', 'name': 'https://hackerone.com/reports/747489', 'refsource': 'MISC', 'tags': ['Permissions Required']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/06/msg00007.html', 'name': '[debian-lts-announce] 20210606 [SECURITY] [DLA 2678-1] ruby-nokogiri security update', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://security.gentoo.org/glsa/202208-29', 'name': 'GLSA-202208-29', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-611'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '1.11.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc1:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc2:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc3:*:*:*:ruby:*:*', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.'}] | 2022-08-15T11:15Z | 2020-12-30T19:15Z | Improper Restriction of XML External Entity Reference | The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. |
XML documents optionally contain a Document Type Definition (DTD), which, among other features, enables the definition of XML entities. It is possible to define an entity by providing a substitution string in the form of a URI. The XML parser can access the contents of this URI and embed these contents back into the XML document for further processing.
By submitting an XML file that defines an external entity with a file:// URI, an attacker can cause the processing application to read the contents of a local file. For example, a URI such as "file:///c:/winnt/win.ini" designates (in Windows) the file C:\Winnt\win.ini, or file:///etc/passwd designates the password file in Unix-based systems. Using URIs with other schemes such as http://, the attacker can force the application to make outgoing requests to servers that the attacker cannot reach directly, which can be used to bypass firewall restrictions or hide the source of attacks such as port scanning.
Once the content of the URI is read, it is fed back into the application that is processing the XML. This application may echo back the data (e.g. in an error message), thereby exposing the file contents.
| https://cwe.mitre.org/data/definitions/611.html | 0 | Mike Dalessio | 2020-11-23 00:47:02-05:00 | feat: XML::Schema and RelaxNG creation accept optional ParseOptions
I'm trying out a new pattern, which is that the parsed object carries
around the ParseOptions it was created with, which should make some
testing a bit easier.
I'm also not implementing the "config block" pattern in use for
Documents, because I think the UX is weird and I'm hoping to change
everything to use kwargs in a 2.0 release, anyway. | 9c87439d9afa14a365ff13e73adc809cb2c3d97b | False | sparklemotion/nokogiri | Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. | 2008-07-14 15:34:32 | 2022-08-27 18:37:30 | https://nokogiri.org/ | sparklemotion | 5886.0 | 885.0 | from_document | from_document( VALUE klass , VALUE document) | ['klass', 'document'] | static VALUE from_document(VALUE klass, VALUE document)
{
xmlDocPtr doc;
xmlSchemaParserCtxtPtr ctx;
xmlSchemaPtr schema;
VALUE errors;
VALUE rb_schema;
Data_Get_Struct(document, xmlDoc, doc);
/* In case someone passes us a node. ugh. */
doc = doc->doc;
if (has_blank_nodes_p(DOC_NODE_CACHE(doc))) {
rb_raise(rb_eArgError, "Creating a schema from a document that has blank nodes exposed to Ruby is dangerous");
}
ctx = xmlSchemaNewDocParserCtxt(doc);
errors = rb_ary_new();
xmlSetStructuredErrorFunc((void *)errors, Nokogiri_error_array_pusher);
#ifdef HAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS
xmlSchemaSetParserStructuredErrors(
ctx,
Nokogiri_error_array_pusher,
(void *)errors
);
#endif
schema = xmlSchemaParse(ctx);
xmlSetStructuredErrorFunc(NULL, NULL);
xmlSchemaFreeParserCtxt(ctx);
if(NULL == schema) {
xmlErrorPtr error = xmlGetLastError();
if(error)
Nokogiri_error_raise(NULL, error);
else
rb_raise(rb_eRuntimeError, "Could not parse document");
return Qnil;
}
rb_schema = Data_Wrap_Struct(klass, 0, dealloc, schema);
rb_iv_set(rb_schema, "@errors", errors);
return rb_schema;
return Qnil;
} | 180 | True | 1 |
CVE-2020-26247 | False | False | False | False | AV:N/AC:L/Au:S/C:P/I:N/A:N | NETWORK | LOW | SINGLE | PARTIAL | NONE | NONE | 4.0 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | NETWORK | LOW | LOW | NONE | UNCHANGED | LOW | NONE | NONE | 4.3 | MEDIUM | 2.8 | 1.4 | False | [{'url': 'https://rubygems.org/gems/nokogiri', 'name': 'https://rubygems.org/gems/nokogiri', 'refsource': 'MISC', 'tags': ['Product', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'name': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'name': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'refsource': 'CONFIRM', 'tags': ['Mitigation', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'name': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://hackerone.com/reports/747489', 'name': 'https://hackerone.com/reports/747489', 'refsource': 'MISC', 'tags': ['Permissions Required']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/06/msg00007.html', 'name': '[debian-lts-announce] 20210606 [SECURITY] [DLA 2678-1] ruby-nokogiri security update', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://security.gentoo.org/glsa/202208-29', 'name': 'GLSA-202208-29', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-611'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '1.11.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc1:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc2:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc3:*:*:*:ruby:*:*', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.'}] | 2022-08-15T11:15Z | 2020-12-30T19:15Z | Improper Restriction of XML External Entity Reference | The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. |
XML documents optionally contain a Document Type Definition (DTD), which, among other features, enables the definition of XML entities. It is possible to define an entity by providing a substitution string in the form of a URI. The XML parser can access the contents of this URI and embed these contents back into the XML document for further processing.
By submitting an XML file that defines an external entity with a file:// URI, an attacker can cause the processing application to read the contents of a local file. For example, a URI such as "file:///c:/winnt/win.ini" designates (in Windows) the file C:\Winnt\win.ini, or file:///etc/passwd designates the password file in Unix-based systems. Using URIs with other schemes such as http://, the attacker can force the application to make outgoing requests to servers that the attacker cannot reach directly, which can be used to bypass firewall restrictions or hide the source of attacks such as port scanning.
Once the content of the URI is read, it is fed back into the application that is processing the XML. This application may echo back the data (e.g. in an error message), thereby exposing the file contents.
| https://cwe.mitre.org/data/definitions/611.html | 0 | Mike Dalessio | 2020-11-23 00:47:02-05:00 | feat: XML::Schema and RelaxNG creation accept optional ParseOptions
I'm trying out a new pattern, which is that the parsed object carries
around the ParseOptions it was created with, which should make some
testing a bit easier.
I'm also not implementing the "config block" pattern in use for
Documents, because I think the UX is weird and I'm hoping to change
everything to use kwargs in a 2.0 release, anyway. | 9c87439d9afa14a365ff13e73adc809cb2c3d97b | False | sparklemotion/nokogiri | Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. | 2008-07-14 15:34:32 | 2022-08-27 18:37:30 | https://nokogiri.org/ | sparklemotion | 5886.0 | 885.0 | init_xml_schema | init_xml_schema() | [] | void init_xml_schema()
{
VALUE nokogiri = rb_define_module("Nokogiri");
VALUE xml = rb_define_module_under(nokogiri, "XML");
VALUE klass = rb_define_class_under(xml, "Schema", rb_cObject);
cNokogiriXmlSchema = klass;
rb_define_singleton_method(klass, "read_memory", read_memory, 1);
rb_define_singleton_method(klass, "from_document", from_document, 1);
rb_define_private_method(klass, "validate_document", validate_document, 1);
rb_define_private_method(klass, "validate_file", validate_file, 1);
} | 83 | True | 1 |
CVE-2020-26247 | False | False | False | False | AV:N/AC:L/Au:S/C:P/I:N/A:N | NETWORK | LOW | SINGLE | PARTIAL | NONE | NONE | 4.0 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | NETWORK | LOW | LOW | NONE | UNCHANGED | LOW | NONE | NONE | 4.3 | MEDIUM | 2.8 | 1.4 | False | [{'url': 'https://rubygems.org/gems/nokogiri', 'name': 'https://rubygems.org/gems/nokogiri', 'refsource': 'MISC', 'tags': ['Product', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'name': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.11.0.rc4', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'name': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-vr8q-g5c7-m54m', 'refsource': 'CONFIRM', 'tags': ['Mitigation', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'name': 'https://github.com/sparklemotion/nokogiri/commit/9c87439d9afa14a365ff13e73adc809cb2c3d97b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://hackerone.com/reports/747489', 'name': 'https://hackerone.com/reports/747489', 'refsource': 'MISC', 'tags': ['Permissions Required']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/06/msg00007.html', 'name': '[debian-lts-announce] 20210606 [SECURITY] [DLA 2678-1] ruby-nokogiri security update', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://security.gentoo.org/glsa/202208-29', 'name': 'GLSA-202208-29', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-611'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '1.11.0', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc1:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc2:*:*:*:ruby:*:*', 'cpe_name': []}, {'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:1.11.0:rc3:*:*:*:ruby:*:*', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Nokogiri is a Rubygem providing HTML, XML, SAX, and Reader parsers with XPath and CSS selector support. In Nokogiri before version 1.11.0.rc4 there is an XXE vulnerability. XML Schemas parsed by Nokogiri::XML::Schema are trusted by default, allowing external resources to be accessed over the network, potentially enabling XXE or SSRF attacks. This behavior is counter to the security policy followed by Nokogiri maintainers, which is to treat all input as untrusted by default whenever possible. This is fixed in Nokogiri version 1.11.0.rc4.'}] | 2022-08-15T11:15Z | 2020-12-30T19:15Z | Improper Restriction of XML External Entity Reference | The software processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. |
XML documents optionally contain a Document Type Definition (DTD), which, among other features, enables the definition of XML entities. It is possible to define an entity by providing a substitution string in the form of a URI. The XML parser can access the contents of this URI and embed these contents back into the XML document for further processing.
By submitting an XML file that defines an external entity with a file:// URI, an attacker can cause the processing application to read the contents of a local file. For example, a URI such as "file:///c:/winnt/win.ini" designates (in Windows) the file C:\Winnt\win.ini, or file:///etc/passwd designates the password file in Unix-based systems. Using URIs with other schemes such as http://, the attacker can force the application to make outgoing requests to servers that the attacker cannot reach directly, which can be used to bypass firewall restrictions or hide the source of attacks such as port scanning.
Once the content of the URI is read, it is fed back into the application that is processing the XML. This application may echo back the data (e.g. in an error message), thereby exposing the file contents.
| https://cwe.mitre.org/data/definitions/611.html | 0 | Mike Dalessio | 2020-11-23 00:47:02-05:00 | feat: XML::Schema and RelaxNG creation accept optional ParseOptions
I'm trying out a new pattern, which is that the parsed object carries
around the ParseOptions it was created with, which should make some
testing a bit easier.
I'm also not implementing the "config block" pattern in use for
Documents, because I think the UX is weird and I'm hoping to change
everything to use kwargs in a 2.0 release, anyway. | 9c87439d9afa14a365ff13e73adc809cb2c3d97b | False | sparklemotion/nokogiri | Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. | 2008-07-14 15:34:32 | 2022-08-27 18:37:30 | https://nokogiri.org/ | sparklemotion | 5886.0 | 885.0 | read_memory | read_memory( VALUE klass , VALUE content) | ['klass', 'content'] | static VALUE read_memory(VALUE klass, VALUE content)
{
xmlSchemaPtr schema;
xmlSchemaParserCtxtPtr ctx = xmlSchemaNewMemParserCtxt(
(const char *)StringValuePtr(content),
(int)RSTRING_LEN(content)
);
VALUE rb_schema;
VALUE errors = rb_ary_new();
xmlSetStructuredErrorFunc((void *)errors, Nokogiri_error_array_pusher);
#ifdef HAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS
xmlSchemaSetParserStructuredErrors(
ctx,
Nokogiri_error_array_pusher,
(void *)errors
);
#endif
schema = xmlSchemaParse(ctx);
xmlSetStructuredErrorFunc(NULL, NULL);
xmlSchemaFreeParserCtxt(ctx);
if(NULL == schema) {
xmlErrorPtr error = xmlGetLastError();
if(error)
Nokogiri_error_raise(NULL, error);
else
rb_raise(rb_eRuntimeError, "Could not parse document");
return Qnil;
}
rb_schema = Data_Wrap_Struct(klass, 0, dealloc, schema);
rb_iv_set(rb_schema, "@errors", errors);
return rb_schema;
} | 152 | True | 1 |
CVE-2022-29181 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:N/A:P | NETWORK | LOW | NONE | PARTIAL | NONE | PARTIAL | 6.4 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | LOW | NONE | HIGH | 8.2 | HIGH | 3.9 | 4.2 | False | [{'url': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.6', 'name': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xh29-r2w5-wx8m', 'name': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xh29-r2w5-wx8m', 'refsource': 'CONFIRM', 'tags': ['Issue Tracking', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/commit/db05ba9a1bd4b90aa6c76742cf6102a7c7297267', 'name': 'https://github.com/sparklemotion/nokogiri/commit/db05ba9a1bd4b90aa6c76742cf6102a7c7297267', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://securitylab.github.com/advisories/GHSL-2022-031_GHSL-2022-032_Nokogiri/', 'name': 'https://securitylab.github.com/advisories/GHSL-2022-031_GHSL-2022-032_Nokogiri/', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202208-29', 'name': 'GLSA-202208-29', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-241'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '1.13.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Nokogiri is an open source XML and HTML library for Ruby. Nokogiri prior to version 1.13.6 does not type-check all inputs into the XML and HTML4 SAX parsers, allowing specially crafted untrusted inputs to cause illegal memory access errors (segfault) or reads from unrelated memory. Version 1.13.6 contains a patch for this issue. As a workaround, ensure the untrusted input is a `String` by calling `#to_s` or equivalent.'}] | 2022-08-15T11:20Z | 2022-05-20T19:15Z | Improper Handling of Unexpected Data Type | The software does not handle or incorrectly handles when a particular element is not the expected type, e.g. it expects a digit (0-9) but is provided with a letter (A-Z). | https://cwe.mitre.org/data/definitions/241.html | 0 | Mike Dalessio | 2022-05-06 21:57:41-04:00 | fix: {HTML4,XML}::SAX::{Parser,ParserContext} check arg types
Previously, arguments of the wrong type might cause segfault on CRuby. | db05ba9a1bd4b90aa6c76742cf6102a7c7297267 | False | sparklemotion/nokogiri | Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. | 2008-07-14 15:34:32 | 2022-08-27 18:37:30 | https://nokogiri.org/ | sparklemotion | 5886.0 | 885.0 | parse_memory | parse_memory( VALUE klass , VALUE data , VALUE encoding) | ['klass', 'data', 'encoding'] | parse_memory(VALUE klass, VALUE data, VALUE encoding)
{
htmlParserCtxtPtr ctxt;
if (NIL_P(data)) {
rb_raise(rb_eArgError, "data cannot be nil");
}
if (!(int)RSTRING_LEN(data)) {
rb_raise(rb_eRuntimeError, "data cannot be empty");
}
ctxt = htmlCreateMemoryParserCtxt(StringValuePtr(data),
(int)RSTRING_LEN(data));
if (ctxt->sax) {
xmlFree(ctxt->sax);
ctxt->sax = NULL;
}
if (RTEST(encoding)) {
xmlCharEncodingHandlerPtr enc = xmlFindCharEncodingHandler(StringValueCStr(encoding));
if (enc != NULL) {
xmlSwitchToEncoding(ctxt, enc);
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
rb_raise(rb_eRuntimeError, "Unsupported encoding %s",
StringValueCStr(encoding));
}
}
}
return Data_Wrap_Struct(klass, NULL, deallocate, ctxt);
} | 160 | True | 1 |
|
CVE-2022-29181 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:N/A:P | NETWORK | LOW | NONE | PARTIAL | NONE | PARTIAL | 6.4 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | LOW | NONE | HIGH | 8.2 | HIGH | 3.9 | 4.2 | False | [{'url': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.6', 'name': 'https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.6', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xh29-r2w5-wx8m', 'name': 'https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xh29-r2w5-wx8m', 'refsource': 'CONFIRM', 'tags': ['Issue Tracking', 'Third Party Advisory']}, {'url': 'https://github.com/sparklemotion/nokogiri/commit/db05ba9a1bd4b90aa6c76742cf6102a7c7297267', 'name': 'https://github.com/sparklemotion/nokogiri/commit/db05ba9a1bd4b90aa6c76742cf6102a7c7297267', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://securitylab.github.com/advisories/GHSL-2022-031_GHSL-2022-032_Nokogiri/', 'name': 'https://securitylab.github.com/advisories/GHSL-2022-031_GHSL-2022-032_Nokogiri/', 'refsource': 'MISC', 'tags': ['Exploit', 'Third Party Advisory']}, {'url': 'https://security.gentoo.org/glsa/202208-29', 'name': 'GLSA-202208-29', 'refsource': 'GENTOO', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-241'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:nokogiri:nokogiri:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '1.13.6', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Nokogiri is an open source XML and HTML library for Ruby. Nokogiri prior to version 1.13.6 does not type-check all inputs into the XML and HTML4 SAX parsers, allowing specially crafted untrusted inputs to cause illegal memory access errors (segfault) or reads from unrelated memory. Version 1.13.6 contains a patch for this issue. As a workaround, ensure the untrusted input is a `String` by calling `#to_s` or equivalent.'}] | 2022-08-15T11:20Z | 2022-05-20T19:15Z | Improper Handling of Unexpected Data Type | The software does not handle or incorrectly handles when a particular element is not the expected type, e.g. it expects a digit (0-9) but is provided with a letter (A-Z). | https://cwe.mitre.org/data/definitions/241.html | 0 | Mike Dalessio | 2022-05-06 21:57:41-04:00 | fix: {HTML4,XML}::SAX::{Parser,ParserContext} check arg types
Previously, arguments of the wrong type might cause segfault on CRuby. | db05ba9a1bd4b90aa6c76742cf6102a7c7297267 | False | sparklemotion/nokogiri | Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. | 2008-07-14 15:34:32 | 2022-08-27 18:37:30 | https://nokogiri.org/ | sparklemotion | 5886.0 | 885.0 | parse_memory | parse_memory( VALUE klass , VALUE data) | ['klass', 'data'] | parse_memory(VALUE klass, VALUE data)
{
xmlParserCtxtPtr ctxt;
if (NIL_P(data)) {
rb_raise(rb_eArgError, "data cannot be nil");
}
if (!(int)RSTRING_LEN(data)) {
rb_raise(rb_eRuntimeError, "data cannot be empty");
}
ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data),
(int)RSTRING_LEN(data));
if (ctxt->sax) {
xmlFree(ctxt->sax);
ctxt->sax = NULL;
}
return Data_Wrap_Struct(klass, NULL, deallocate, ctxt);
} | 100 | True | 1 |
|
CVE-2020-26298 | False | False | False | True | AV:N/AC:M/Au:N/C:N/I:P/A:N | NETWORK | MEDIUM | NONE | NONE | PARTIAL | NONE | 4.3 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N | NETWORK | LOW | LOW | REQUIRED | CHANGED | LOW | LOW | NONE | 5.4 | MEDIUM | 2.3 | 2.7 | False | [{'url': 'https://github.com/vmg/redcarpet/commit/a699c82292b17c8e6a62e1914d5eccc252272793', 'name': 'https://github.com/vmg/redcarpet/commit/a699c82292b17c8e6a62e1914d5eccc252272793', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://rubygems.org/gems/redcarpet', 'name': 'https://rubygems.org/gems/redcarpet', 'refsource': 'MISC', 'tags': ['Product', 'Third Party Advisory']}, {'url': 'https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md#version-351-security', 'name': 'https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md#version-351-security', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/advisories/GHSA-q3wr-qw3g-3p4h', 'name': 'https://github.com/advisories/GHSA-q3wr-qw3g-3p4h', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/01/msg00014.html', 'name': '[debian-lts-announce] 20210115 [SECURITY] [DLA 2526-1] ruby-redcarpet security update', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://www.debian.org/security/2021/dsa-4831', 'name': 'DSA-4831', 'refsource': 'DEBIAN', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-79'}, {'lang': 'en', 'value': 'CWE-74'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:redcarpet_project:redcarpet:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '3.5.1', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Redcarpet is a Ruby library for Markdown processing. In Redcarpet before version 3.5.1, there is an injection vulnerability which can enable a cross-site scripting attack. In affected versions no HTML escaping was being performed when processing quotes. This applies even when the `:escape_html` option was being used. This is fixed in version 3.5.1 by the referenced commit.'}] | 2021-01-16T04:15Z | 2021-01-11T19:15Z | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | Software has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features which classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. The most classic instantiations of this category of weakness are SQL injection and format string vulnerabilities.
| https://cwe.mitre.org/data/definitions/74.html | 0 | Robin Dupret | 2020-12-15 20:57:32+01:00 | Fix a security issue using `:quote` with `:escape_html`
Reported by @johan-smits. | a699c82292b17c8e6a62e1914d5eccc252272793 | False | vmg/redcarpet | The safe Markdown parser, reloaded. | 2011-03-24 22:05:14 | 2022-04-04 08:16:47 | vmg | 4778.0 | 527.0 | rndr_quote | rndr_quote( struct buf * ob , const struct buf * text , void * opaque) | ['ob', 'text', 'opaque'] | rndr_quote(struct buf *ob, const struct buf *text, void *opaque)
{
if (!text || !text->size)
return 0;
BUFPUTSL(ob, "<q>");
bufput(ob, text->data, text->size);
BUFPUTSL(ob, "</q>");
return 1;
} | 62 | True | 1 |
|
CVE-2020-26298 | False | False | False | True | AV:N/AC:M/Au:N/C:N/I:P/A:N | NETWORK | MEDIUM | NONE | NONE | PARTIAL | NONE | 4.3 | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N | NETWORK | LOW | LOW | REQUIRED | CHANGED | LOW | LOW | NONE | 5.4 | MEDIUM | 2.3 | 2.7 | False | [{'url': 'https://github.com/vmg/redcarpet/commit/a699c82292b17c8e6a62e1914d5eccc252272793', 'name': 'https://github.com/vmg/redcarpet/commit/a699c82292b17c8e6a62e1914d5eccc252272793', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://rubygems.org/gems/redcarpet', 'name': 'https://rubygems.org/gems/redcarpet', 'refsource': 'MISC', 'tags': ['Product', 'Third Party Advisory']}, {'url': 'https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md#version-351-security', 'name': 'https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md#version-351-security', 'refsource': 'MISC', 'tags': ['Release Notes', 'Third Party Advisory']}, {'url': 'https://github.com/advisories/GHSA-q3wr-qw3g-3p4h', 'name': 'https://github.com/advisories/GHSA-q3wr-qw3g-3p4h', 'refsource': 'CONFIRM', 'tags': ['Third Party Advisory']}, {'url': 'https://lists.debian.org/debian-lts-announce/2021/01/msg00014.html', 'name': '[debian-lts-announce] 20210115 [SECURITY] [DLA 2526-1] ruby-redcarpet security update', 'refsource': 'MLIST', 'tags': []}, {'url': 'https://www.debian.org/security/2021/dsa-4831', 'name': 'DSA-4831', 'refsource': 'DEBIAN', 'tags': []}] | [{'description': [{'lang': 'en', 'value': 'CWE-79'}, {'lang': 'en', 'value': 'CWE-74'}]}] | MEDIUM | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:redcarpet_project:redcarpet:*:*:*:*:*:ruby:*:*', 'versionEndExcluding': '3.5.1', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'Redcarpet is a Ruby library for Markdown processing. In Redcarpet before version 3.5.1, there is an injection vulnerability which can enable a cross-site scripting attack. In affected versions no HTML escaping was being performed when processing quotes. This applies even when the `:escape_html` option was being used. This is fixed in version 3.5.1 by the referenced commit.'}] | 2021-01-16T04:15Z | 2021-01-11T19:15Z | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. |
Cross-site scripting (XSS) vulnerabilities occur when:
Untrusted data enters a web application, typically from a web request.
The web application dynamically generates a web page that contains this untrusted data.
During page generation, the application does not prevent the data from containing content that is executable by a web browser, such as JavaScript, HTML tags, HTML attributes, mouse events, Flash, ActiveX, etc.
A victim visits the generated web page through a web browser, which contains malicious script that was injected using the untrusted data.
Since the script comes from a web page that was sent by the web server, the victim's web browser executes the malicious script in the context of the web server's domain.
This effectively violates the intention of the web browser's same-origin policy, which states that scripts in one domain should not be able to access resources or run code in a different domain.
There are three main kinds of XSS:
Type 1: Reflected XSS (or Non-Persistent) -
The server reads data directly from the HTTP request and reflects it back in the HTTP response. Reflected XSS exploits occur when an attacker causes a victim to supply dangerous content to a vulnerable web application, which is then reflected back to the victim and executed by the web browser. The most common mechanism for delivering malicious content is to include it as a parameter in a URL that is posted publicly or e-mailed directly to the victim. URLs constructed in this manner constitute the core of many phishing schemes, whereby an attacker convinces a victim to visit a URL that refers to a vulnerable site. After the site reflects the attacker's content back to the victim, the content is executed by the victim's browser.
Type 2: Stored XSS (or Persistent) -
The application stores dangerous data in a database, message forum, visitor log, or other trusted data store. At a later time, the dangerous data is subsequently read back into the application and included in dynamic content. From an attacker's perspective, the optimal place to inject malicious content is in an area that is displayed to either many users or particularly interesting users. Interesting users typically have elevated privileges in the application or interact with sensitive data that is valuable to the attacker. If one of these users executes malicious content, the attacker may be able to perform privileged operations on behalf of the user or gain access to sensitive data belonging to the user. For example, the attacker might inject XSS into a log message, which might not be handled properly when an administrator views the logs.
Type 0: DOM-Based XSS -
In DOM-based XSS, the client performs the injection of XSS into the page; in the other types, the server performs the injection. DOM-based XSS generally involves server-controlled, trusted script that is sent to the client, such as Javascript that performs sanity checks on a form before the user submits it. If the server-supplied script processes user-supplied data and then injects it back into the web page (such as with dynamic HTML), then DOM-based XSS is possible.
Once the malicious script is injected, the attacker can perform a variety of malicious activities. The attacker could transfer private information, such as cookies that may include session information, from the victim's machine to the attacker. The attacker could send malicious requests to a web site on behalf of the victim, which could be especially dangerous to the site if the victim has administrator privileges to manage that site. Phishing attacks could be used to emulate trusted web sites and trick the victim into entering a password, allowing the attacker to compromise the victim's account on that web site. Finally, the script could exploit a vulnerability in the web browser itself possibly taking over the victim's machine, sometimes referred to as "drive-by hacking."
In many cases, the attack can be launched without the victim even being aware of it. Even with careful users, attackers frequently use a variety of methods to encode the malicious portion of the attack, such as URL encoding or Unicode, so the request looks less suspicious.
| https://cwe.mitre.org/data/definitions/79.html | 0 | Robin Dupret | 2020-12-15 20:57:32+01:00 | Fix a security issue using `:quote` with `:escape_html`
Reported by @johan-smits. | a699c82292b17c8e6a62e1914d5eccc252272793 | False | vmg/redcarpet | The safe Markdown parser, reloaded. | 2011-03-24 22:05:14 | 2022-04-04 08:16:47 | vmg | 4778.0 | 527.0 | rndr_quote | rndr_quote( struct buf * ob , const struct buf * text , void * opaque) | ['ob', 'text', 'opaque'] | rndr_quote(struct buf *ob, const struct buf *text, void *opaque)
{
if (!text || !text->size)
return 0;
BUFPUTSL(ob, "<q>");
bufput(ob, text->data, text->size);
BUFPUTSL(ob, "</q>");
return 1;
} | 62 | True | 1 |
|
CVE-2020-26759 | False | False | False | False | AV:N/AC:L/Au:N/C:P/I:P/A:P | NETWORK | LOW | NONE | PARTIAL | PARTIAL | PARTIAL | 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | NETWORK | LOW | NONE | NONE | UNCHANGED | HIGH | HIGH | HIGH | 9.8 | CRITICAL | 3.9 | 5.9 | False | [{'url': 'https://github.com/mymarilyn/clickhouse-driver/commit/d708ed548e1d6f254ba81a21de8ba543a53b5598', 'name': 'https://github.com/mymarilyn/clickhouse-driver/commit/d708ed548e1d6f254ba81a21de8ba543a53b5598', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}, {'url': 'https://github.com/mymarilyn/clickhouse-driver/commit/3e990547e064b8fca916b23a0f7d6fe8c63c7f6b', 'name': 'https://github.com/mymarilyn/clickhouse-driver/commit/3e990547e064b8fca916b23a0f7d6fe8c63c7f6b', 'refsource': 'MISC', 'tags': ['Patch', 'Third Party Advisory']}] | [{'description': [{'lang': 'en', 'value': 'CWE-120'}]}] | HIGH | [{'operator': 'OR', 'children': [], 'cpe_match': [{'vulnerable': True, 'cpe23Uri': 'cpe:2.3:a:clickhouse-driver_project:clickhouse-driver:*:*:*:*:*:*:*:*', 'versionEndExcluding': '0.1.5', 'cpe_name': []}]}] | [{'lang': 'en', 'value': 'clickhouse-driver before 0.1.5 allows a malicious clickhouse server to trigger a crash or execute arbitrary code (on a database client) via a crafted server response, due to a buffer overflow.'}] | 2021-01-08T21:19Z | 2021-01-06T13:15Z | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The program copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | A buffer overflow condition exists when a program attempts to put more data in a buffer than it can hold, or when a program attempts to put data in a memory area outside of the boundaries of a buffer. The simplest type of error, and the most common cause of buffer overflows, is the "classic" case in which the program copies the buffer without restricting how much is copied. Other variants exist, but the existence of a classic overflow strongly suggests that the programmer is not considering even the most basic of security protections.
| https://cwe.mitre.org/data/definitions/120.html | 0 | Konstantin Lebedev | 2020-09-11 16:16:33+03:00 | Fix read_varint overflow | d708ed548e1d6f254ba81a21de8ba543a53b5598 | False | mymarilyn/clickhouse-driver | ClickHouse Python Driver with native interface support | 2017-05-10 22:13:04 | 2022-08-26 12:08:22 | https://clickhouse-driver.readthedocs.io | mymarilyn | 900.0 | 171.0 | __Pyx_InitCachedConstants | __Pyx_InitCachedConstants( void) | ['void'] | static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
/* "clickhouse_driver/varint.pyx":4
*
*
* def write_varint(Py_ssize_t number, buf): # <<<<<<<<<<<<<<
* """
* Writes integer of variable length using LEB128.
*/
__pyx_tuple_ = PyTuple_Pack(5, __pyx_n_s_number, __pyx_n_s_buf, __pyx_n_s_i, __pyx_n_s_towrite, __pyx_n_s_num_buf); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 4, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple_);
__Pyx_GIVEREF(__pyx_tuple_);
__pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_varint_pyx, __pyx_n_s_write_varint, 4, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 4, __pyx_L1_error)
/* "clickhouse_driver/varint.pyx":29
*
*
* def read_varint(f): # <<<<<<<<<<<<<<
* """
* Reads integer of variable length using LEB128.
*/
__pyx_tuple__3 = PyTuple_Pack(5, __pyx_n_s_f, __pyx_n_s_shift, __pyx_n_s_result, __pyx_n_s_i, __pyx_n_s_read_one); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_GOTREF(__pyx_tuple__3);
__Pyx_GIVEREF(__pyx_tuple__3);
__pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_clickhouse_driver_varint_pyx, __pyx_n_s_read_varint, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 29, __pyx_L1_error)
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
} | 232 | True | 1 |
Subsets and Splits