@@ -114,6 +114,11 @@ JsVar *jswrap_function_constructor(JsVar *args) {
114
114
jsvObjectIteratorNext (& it );
115
115
}
116
116
jsvObjectIteratorFree (& it );
117
+ if (!jsvIsString (v )) {
118
+ jsExceptionHere (JSET_TYPEERROR ,"Function code must be a String, got '%t'" , v );
119
+ jsvUnLock2 (v ,fn );
120
+ return NULL ;
121
+ }
117
122
jsvObjectSetChildAndUnLock (fn , JSPARSE_FUNCTION_CODE_NAME , v );
118
123
return fn ;
119
124
}
@@ -298,7 +303,7 @@ JsVar *jswrap_btoa(JsVar *binaryData) {
298
303
jsExceptionHere (JSET_ERROR , "Expecting a string or array, got %t" , binaryData );
299
304
return 0 ;
300
305
}
301
- size_t inputLength = jsvGetLength (binaryData );
306
+ size_t inputLength = ( size_t ) jsvGetLength (binaryData );
302
307
size_t outputLength = ((inputLength + 2 )/3 )* 4 ;
303
308
JsVar * base64Data = jsvNewStringOfLength ((unsigned int )outputLength , NULL );
304
309
if (!base64Data ) return 0 ;
@@ -487,8 +492,8 @@ JsVar *jswrap_decodeURIComponent(JsVar *arg) {
487
492
if (ch != '%' ) {
488
493
jsvStringIteratorAppend (& dst , ch );
489
494
} else {
490
- int hi = jsvStringIteratorGetCharAndNext (& it );
491
- int lo = jsvStringIteratorGetCharAndNext (& it );
495
+ char hi = ( char ) jsvStringIteratorGetCharAndNext (& it );
496
+ char lo = ( char ) jsvStringIteratorGetCharAndNext (& it );
492
497
int v = (char )hexToByte (hi ,lo );
493
498
if (v < 0 ) {
494
499
jsExceptionHere (JSET_ERROR , "Invalid URI\n" );
0 commit comments