bugfix: strict byte range check
This commit is contained in:
parent
df68b0ed72
commit
956ea81f63
|
@ -56,7 +56,7 @@ pic_blob_bytevector(pic_state *pic)
|
|||
TYPE_CHECK(pic, argv[i], int);
|
||||
|
||||
if (pic_int(pic, argv[i]) < 0 || pic_int(pic, argv[i]) > 255) {
|
||||
pic_error(pic, "byte out of range", 0);
|
||||
pic_error(pic, "byte out of range", 1, argv[i]);
|
||||
}
|
||||
|
||||
*data++ = (unsigned char)pic_int(pic, argv[i]);
|
||||
|
@ -74,7 +74,7 @@ pic_blob_make_bytevector(pic_state *pic)
|
|||
pic_get_args(pic, "i|i", &k, &b);
|
||||
|
||||
if (b < 0 || b > 255)
|
||||
pic_error(pic, "byte out of range", 0);
|
||||
pic_error(pic, "byte out of range", 1, pic_int_value(pic, b));
|
||||
|
||||
if (k < 0) {
|
||||
pic_error(pic, "make-bytevector: negative length given", 1, pic_int_value(pic, k));
|
||||
|
@ -119,7 +119,7 @@ pic_blob_bytevector_u8_set(pic_state *pic)
|
|||
pic_get_args(pic, "bii", &buf, &len, &k, &v);
|
||||
|
||||
if (v < 0 || v > 255)
|
||||
pic_error(pic, "byte out of range", 0);
|
||||
pic_error(pic, "byte out of range", 1, pic_int_value(pic, v));
|
||||
|
||||
VALID_INDEX(pic, len, k);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ pic_value pic_data_value(pic_state *, void *ptr, const pic_data_type *type);
|
|||
int pic_int(pic_state *, pic_value i);
|
||||
double pic_float(pic_state *, pic_value f);
|
||||
char pic_char(pic_state *, pic_value c);
|
||||
#define pic_bool(pic,b) (! pic_false_p(pic, b))
|
||||
#define pic_bool(pic,b) (! pic_false_p(pic, (b)))
|
||||
const char *pic_str(pic_state *, pic_value str, int *len);
|
||||
unsigned char *pic_blob(pic_state *, pic_value blob, int *len);
|
||||
void *pic_data(pic_state *, pic_value data);
|
||||
|
|
|
@ -61,7 +61,9 @@ pic_value pic_global_ref(pic_state *pic, pic_value uid);
|
|||
void pic_global_set(pic_state *pic, pic_value uid, pic_value value);
|
||||
|
||||
#define MKCALL(cxt,argc) \
|
||||
((cxt)->tmpcode[0] = OP_CALL, (cxt)->tmpcode[1] = (argc), (cxt)->tmpcode)
|
||||
((argc) < 256 \
|
||||
? ((cxt)->tmpcode[0] = OP_CALL, (cxt)->tmpcode[1] = (argc), (cxt)->tmpcode) \
|
||||
: (pic_error(pic, "too many arguments", 1, pic_int_value(pic, (argc))), NULL))
|
||||
|
||||
#define CONTEXT_VINITK(pic,cxt,proc,k,n,ap) do { \
|
||||
int i; \
|
||||
|
|
Loading…
Reference in New Issue