ffi 1.11.2 → 1.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/ext/ffi_c/AbstractMemory.c +5 -9
- data/ext/ffi_c/Call.c +0 -4
- data/ext/ffi_c/DynamicLibrary.c +1 -1
- data/ext/ffi_c/Function.c +1 -1
- data/ext/ffi_c/Types.c +1 -1
- data/lib/ffi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 644662e700692019ada112b10a164622c08978bbe2aecfeb38205a43df099e28
|
4
|
+
data.tar.gz: 8699b821c2200c62c49c4265d5ce8b67862f53d71e1a2862b41ed5f44eedad87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aee46baf520f91e112a1fdcd40218f51f100b50f56d126a94982d341f38919f3f550831db1c9da569d8457c2b50707654681b06ae6cae48ac4597d927b0569d
|
7
|
+
data.tar.gz: c728916db8dad5ec04403ab9cead139b870f56d3e0a34f0b08ec467f9a153c1f29d2f9ad2e30bb3056476a4dd3d42edebfdfbd9f88477f9e08862601cb3277a0
|
data/CHANGELOG.md
CHANGED
data/ext/ffi_c/AbstractMemory.c
CHANGED
@@ -417,7 +417,7 @@ memory_get_string(int argc, VALUE* argv, VALUE self)
|
|
417
417
|
checkBounds(ptr, off, len);
|
418
418
|
|
419
419
|
end = memchr(ptr->address + off, 0, len);
|
420
|
-
return
|
420
|
+
return rb_str_new((char *) ptr->address + off,
|
421
421
|
(end != NULL ? end - ptr->address - off : len));
|
422
422
|
}
|
423
423
|
|
@@ -453,7 +453,7 @@ memory_get_array_of_string(int argc, VALUE* argv, VALUE self)
|
|
453
453
|
|
454
454
|
for (i = 0; i < count; ++i) {
|
455
455
|
const char* strptr = *((const char**) (ptr->address + off) + i);
|
456
|
-
rb_ary_push(retVal, (strptr == NULL ? Qnil :
|
456
|
+
rb_ary_push(retVal, (strptr == NULL ? Qnil : rb_str_new2(strptr)));
|
457
457
|
}
|
458
458
|
|
459
459
|
} else {
|
@@ -463,7 +463,7 @@ memory_get_array_of_string(int argc, VALUE* argv, VALUE self)
|
|
463
463
|
if (strptr == NULL) {
|
464
464
|
break;
|
465
465
|
}
|
466
|
-
rb_ary_push(retVal,
|
466
|
+
rb_ary_push(retVal, rb_str_new2(strptr));
|
467
467
|
}
|
468
468
|
}
|
469
469
|
|
@@ -542,7 +542,7 @@ memory_get_bytes(VALUE self, VALUE offset, VALUE length)
|
|
542
542
|
checkRead(ptr);
|
543
543
|
checkBounds(ptr, off, len);
|
544
544
|
|
545
|
-
return
|
545
|
+
return rb_str_new((char *) ptr->address + off, len);
|
546
546
|
}
|
547
547
|
|
548
548
|
/*
|
@@ -583,10 +583,6 @@ memory_put_bytes(int argc, VALUE* argv, VALUE self)
|
|
583
583
|
checkWrite(ptr);
|
584
584
|
checkBounds(ptr, off, len);
|
585
585
|
|
586
|
-
if (rb_safe_level() >= 1 && OBJ_TAINTED(str)) {
|
587
|
-
rb_raise(rb_eSecurityError, "Writing unsafe string to memory");
|
588
|
-
return Qnil;
|
589
|
-
}
|
590
586
|
memcpy(ptr->address + off, RSTRING_PTR(str) + idx, len);
|
591
587
|
|
592
588
|
return self;
|
@@ -718,7 +714,7 @@ memory_op_get_strptr(AbstractMemory* ptr, long offset)
|
|
718
714
|
memcpy(&tmp, ptr->address + offset, sizeof(tmp));
|
719
715
|
}
|
720
716
|
|
721
|
-
return tmp != NULL ?
|
717
|
+
return tmp != NULL ? rb_str_new2(tmp) : Qnil;
|
722
718
|
}
|
723
719
|
|
724
720
|
static void
|
data/ext/ffi_c/Call.c
CHANGED
@@ -298,10 +298,6 @@ rbffi_SetupCallParams(int argc, VALUE* argv, int paramCount, Type** paramTypes,
|
|
298
298
|
param->ptr = NULL;
|
299
299
|
|
300
300
|
} else {
|
301
|
-
if (rb_safe_level() >= 1 && OBJ_TAINTED(argv[argidx])) {
|
302
|
-
rb_raise(rb_eSecurityError, "Unsafe string parameter");
|
303
|
-
}
|
304
|
-
|
305
301
|
param->ptr = StringValueCStr(argv[argidx]);
|
306
302
|
}
|
307
303
|
|
data/ext/ffi_c/DynamicLibrary.c
CHANGED
data/ext/ffi_c/Function.c
CHANGED
@@ -724,7 +724,7 @@ invoke_callback(VALUE data)
|
|
724
724
|
param = rbffi_longdouble_new(*(long double *) parameters[i]);
|
725
725
|
break;
|
726
726
|
case NATIVE_STRING:
|
727
|
-
param = (*(void **) parameters[i] != NULL) ?
|
727
|
+
param = (*(void **) parameters[i] != NULL) ? rb_str_new2(*(char **) parameters[i]) : Qnil;
|
728
728
|
break;
|
729
729
|
case NATIVE_POINTER:
|
730
730
|
param = rbffi_Pointer_NewInstance(*(void **) parameters[i]);
|
data/ext/ffi_c/Types.c
CHANGED
@@ -80,7 +80,7 @@ rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr)
|
|
80
80
|
return rbffi_longdouble_new(*(long double *) ptr);
|
81
81
|
|
82
82
|
case NATIVE_STRING:
|
83
|
-
return (*(void **) ptr != NULL) ?
|
83
|
+
return (*(void **) ptr != NULL) ? rb_str_new2(*(char **) ptr) : Qnil;
|
84
84
|
case NATIVE_POINTER:
|
85
85
|
return rbffi_Pointer_NewInstance(*(void **) ptr);
|
86
86
|
case NATIVE_BOOL:
|
data/lib/ffi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wayne Meissner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|