stringio 3.1.1 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +53 -0
- data/ext/stringio/stringio.c +24 -13
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9f7204dcb94ef40c0b88ca4b8687976b15343e5d1fd4061f6f950ed233d6559
|
4
|
+
data.tar.gz: 2af6f911dcfba01b80c03a0de22ac90edf271f3f4904fc56abd635bb7eb14ee9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7539db6bc763bb420aa5d0e669d91c4da3405bd78f2897af22eba0f10f22863b03dc5e7ba386d1abf7ef08e7af7a3f36880f55f394594f33ecace42166bbd14
|
7
|
+
data.tar.gz: 23ad934633417cfb11780d9017a4e9a7446f07eae7cb1ff4cafb9a118301bbf315fc347fd889ea97ebdd2a67819d1ee07c4af7c53d11b4e060ec9eb095ab7925
|
data/NEWS.md
CHANGED
@@ -1,5 +1,58 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.1.5 - 2025-02-21
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* JRuby: Improved compatibility with CRuby for `StringIO#seek` with
|
8
|
+
frozen string.
|
9
|
+
* GH-119
|
10
|
+
* GH-121
|
11
|
+
|
12
|
+
## 3.1.4 - 2025-02-20
|
13
|
+
|
14
|
+
### Improvements
|
15
|
+
|
16
|
+
* JRuby: Improved compatibility with CRuby.
|
17
|
+
* GH-116
|
18
|
+
|
19
|
+
### Fixes
|
20
|
+
|
21
|
+
* CRuby: Fixed a bug that `StringIO` may mutate a shared string.
|
22
|
+
* GH-117
|
23
|
+
|
24
|
+
## 3.1.3 - 2025-02-14
|
25
|
+
|
26
|
+
### Fixes
|
27
|
+
|
28
|
+
* JRuby: Fixed a bug that JRuby may not be able to be started
|
29
|
+
* GH-112
|
30
|
+
* GH-113
|
31
|
+
* Reported by Karol Bucek
|
32
|
+
|
33
|
+
### Thanks
|
34
|
+
|
35
|
+
* Karol Bucek
|
36
|
+
|
37
|
+
## 3.1.2 - 2024-11-07
|
38
|
+
|
39
|
+
### Improvements
|
40
|
+
|
41
|
+
* JRuby: Added support for detecting encoding by BOM.
|
42
|
+
* GH-100
|
43
|
+
* GH-101
|
44
|
+
|
45
|
+
### Fixes
|
46
|
+
|
47
|
+
* CRuby: Fixed a bug that unknown memory may be used by
|
48
|
+
`StringIO#ungetc`/`StringIO#ungetbyte`.
|
49
|
+
* https://hackerone.com/reports/2805165
|
50
|
+
* Reported by manun.
|
51
|
+
|
52
|
+
### Thanks
|
53
|
+
|
54
|
+
* manun
|
55
|
+
|
3
56
|
## 3.1.1 - 2024-06-13
|
4
57
|
|
5
58
|
### Improvements
|
data/ext/stringio/stringio.c
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
**********************************************************************/
|
14
14
|
|
15
15
|
static const char *const
|
16
|
-
STRINGIO_VERSION = "3.1.
|
16
|
+
STRINGIO_VERSION = "3.1.5";
|
17
17
|
|
18
18
|
#include <stdbool.h>
|
19
19
|
|
@@ -180,6 +180,7 @@ check_modifiable(struct StringIO *ptr)
|
|
180
180
|
else if (OBJ_FROZEN_RAW(ptr->string)) {
|
181
181
|
rb_raise(rb_eIOError, "not modifiable string");
|
182
182
|
}
|
183
|
+
rb_str_modify(ptr->string);
|
183
184
|
}
|
184
185
|
|
185
186
|
static VALUE
|
@@ -930,6 +931,18 @@ strio_extend(struct StringIO *ptr, long pos, long len)
|
|
930
931
|
}
|
931
932
|
}
|
932
933
|
|
934
|
+
static void
|
935
|
+
strio_unget_string(struct StringIO *ptr, VALUE c)
|
936
|
+
{
|
937
|
+
const char *cp = NULL;
|
938
|
+
long cl = RSTRING_LEN(c);
|
939
|
+
if (cl > 0) {
|
940
|
+
if (c != ptr->string) cp = RSTRING_PTR(c);
|
941
|
+
strio_unget_bytes(ptr, cp, cl);
|
942
|
+
RB_GC_GUARD(c);
|
943
|
+
}
|
944
|
+
}
|
945
|
+
|
933
946
|
/*
|
934
947
|
* call-seq:
|
935
948
|
* ungetc(character) -> nil
|
@@ -952,19 +965,22 @@ strio_ungetc(VALUE self, VALUE c)
|
|
952
965
|
|
953
966
|
enc = rb_enc_get(ptr->string);
|
954
967
|
len = rb_enc_codelen(cc, enc);
|
955
|
-
if (len <= 0)
|
968
|
+
if (len <= 0) {
|
969
|
+
rb_enc_uint_chr(cc, enc); /* to raise an exception */
|
970
|
+
UNREACHABLE;
|
971
|
+
}
|
956
972
|
rb_enc_mbcput(cc, buf, enc);
|
957
973
|
return strio_unget_bytes(ptr, buf, len);
|
958
974
|
}
|
959
975
|
else {
|
960
|
-
|
976
|
+
StringValue(c);
|
977
|
+
if (RSTRING_LEN(c) == 0) return Qnil;
|
961
978
|
enc = rb_enc_get(ptr->string);
|
962
979
|
enc2 = rb_enc_get(c);
|
963
980
|
if (enc != enc2 && enc != rb_ascii8bit_encoding()) {
|
964
981
|
c = rb_str_conv_enc(c, enc2, enc);
|
965
982
|
}
|
966
|
-
|
967
|
-
RB_GC_GUARD(c);
|
983
|
+
strio_unget_string(ptr, c);
|
968
984
|
return Qnil;
|
969
985
|
}
|
970
986
|
}
|
@@ -991,13 +1007,8 @@ strio_ungetbyte(VALUE self, VALUE c)
|
|
991
1007
|
strio_unget_bytes(ptr, &cc, 1);
|
992
1008
|
}
|
993
1009
|
else {
|
994
|
-
|
995
|
-
|
996
|
-
cl = RSTRING_LEN(c);
|
997
|
-
if (cl > 0) {
|
998
|
-
strio_unget_bytes(ptr, RSTRING_PTR(c), cl);
|
999
|
-
RB_GC_GUARD(c);
|
1000
|
-
}
|
1010
|
+
StringValue(c);
|
1011
|
+
strio_unget_string(ptr, c);
|
1001
1012
|
}
|
1002
1013
|
return Qnil;
|
1003
1014
|
}
|
@@ -1028,7 +1039,7 @@ strio_unget_bytes(struct StringIO *ptr, const char *cp, long cl)
|
|
1028
1039
|
if (rest > cl) memset(s + len, 0, rest - cl);
|
1029
1040
|
pos -= cl;
|
1030
1041
|
}
|
1031
|
-
memcpy(s + pos, cp, cl);
|
1042
|
+
memcpy(s + pos, (cp ? cp : s), cl);
|
1032
1043
|
ptr->pos = pos;
|
1033
1044
|
return Qnil;
|
1034
1045
|
}
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stringio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nobu Nakada
|
8
8
|
- Charles Oliver Nutter
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-02-21 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Pseudo `IO` class from/to `String`.
|
15
14
|
email:
|
@@ -42,8 +41,8 @@ homepage: https://github.com/ruby/stringio
|
|
42
41
|
licenses:
|
43
42
|
- Ruby
|
44
43
|
- BSD-2-Clause
|
45
|
-
metadata:
|
46
|
-
|
44
|
+
metadata:
|
45
|
+
changelog_uri: https://github.com/ruby/stringio/releases/tag/v3.1.5
|
47
46
|
rdoc_options: []
|
48
47
|
require_paths:
|
49
48
|
- lib
|
@@ -58,8 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
57
|
- !ruby/object:Gem::Version
|
59
58
|
version: '0'
|
60
59
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
62
|
-
signing_key:
|
60
|
+
rubygems_version: 3.6.2
|
63
61
|
specification_version: 4
|
64
62
|
summary: Pseudo IO on String
|
65
63
|
test_files: []
|