Yukihiro "Matz" Matsumoto
4c25738ac7
Merge str_buf_cat and mrb_str_cat.
2017-08-18 22:17:47 +09:00
Yukihiro "Matz" Matsumoto
0ff28c9e60
Silence integer type conversion warnings.
2017-08-11 13:10:31 +09:00
Christopher Aue
2fadddcd20
Replaced tabs with spaces
2017-08-09 21:56:27 +02:00
Christopher Aue
c7018ea962
Added mrb_str_index to the mrb API
2017-07-28 21:07:20 +02:00
Yukihiro "Matz" Matsumoto
a18904a4c2
Use "$!" specifier of mrb_get_args.
2017-07-12 14:49:55 +09:00
Yukihiro "Matz" Matsumoto
c377d504f6
Avoid undefined behavior of signed integer overflow; fix #3728
2017-07-05 03:11:39 +09:00
ksss
bdb36b3404
Make string embad from shared
2017-05-13 22:44:52 +09:00
ksss
8cba9a9e42
Adjust to the optimum type
2017-05-05 14:20:21 +09:00
Yukihiro "Matz" Matsumoto
5e79bc9377
Make String#replace to check equality before modifying flags.
...
ref #3588
2017-04-06 08:25:25 +09:00
Yukihiro "Matz" Matsumoto
77331d127b
Unify else clause style
2017-04-03 16:56:27 +09:00
Yukihiro "Matz" Matsumoto
d27a3d47cd
String#initialize to make a string empty; ref #3574
2017-04-03 10:22:38 +09:00
ksss
76e10351fa
String#index shouldn't return nil when "".index ""
2017-03-05 14:15:18 +09:00
Yukihiro "Matz" Matsumoto
7db0786abd
Fix integer overflow; fix #3473
...
The fix is suggested by https://hackerone.com/lucnguyen
2017-02-28 09:54:56 +09:00
Yukihiro "Matz" Matsumoto
405f5a2d2a
Add type check by mrb_get_args(); ref #3476
2017-02-28 09:30:06 +09:00
Yukihiro "Matz" Matsumoto
74dbee8e52
Add check before calling str_substr(); ref #3476
2017-02-28 09:21:24 +09:00
Yukihiro "Matz" Matsumoto
bdac7dfae8
Check if the value is fixnum before mrb_funcall(); fix #3476
...
The issue is reported by https://hackerone.com/aerodudrizzt
2017-02-28 09:14:42 +09:00
Tomasz Dabrowski
90f262f642
Revert "Optimization for String#* for 1-byte strings"
...
This reverts commit d1bc7caeca .
2017-02-11 13:02:48 +01:00
Yukihiro "Matz" Matsumoto
8f4a929e1a
String#replace should update s->flags for MRB_STR_NO_UTF.
...
Otherwise String#size may return wrong length; fix #3448
2017-02-11 16:27:07 +09:00
Yukihiro "Matz" Matsumoto
6cb7aef563
Add type cast to pacify warning
2017-02-11 16:00:26 +09:00
Tomasz Dabrowski
d1bc7caeca
Optimization for String#* for 1-byte strings
2017-02-10 15:31:33 +01:00
Edgar Boda-Majer
46e4e342f4
Fix interpolation escaping in String.inspect
2017-02-07 13:33:53 +01:00
Yukihiro "Matz" Matsumoto
5e1d923381
Changed the behavior of mrb_range_beg_len(); close #3411
...
The new API is:
int mrb_range_beg_len(mrb, range, &beg, &len, len, trunc)
The new argument `trunc` is a boolean value that specifies
whether the function truncates the range. The new return value
is an integer instead of a boolean, that is:
0: not a range
1: range with proper edges
2: out of range
To get the old behavior, you have to rewrite:
mrb_range_beg_len(mrb, range, &beg, &len, len)
to:
mrn_range_beg_len(mrb, range, &beg, &len, len, TRUE) == 1
[Breaking Change]
2017-01-23 14:35:26 +09:00
Yukihiro "Matz" Matsumoto
708088c5fa
Should not make empty strings shared; fix #3407
2017-01-23 10:52:40 +09:00
Yukihiro "Matz" Matsumoto
e1ff71029f
String#replace should check replacing string; fix #3374
...
This issue was reported by https://hackerone.com/tunz
2017-01-11 17:51:11 +09:00
Yukihiro "Matz" Matsumoto
885d929398
Improve capacity enhancing conditions
2017-01-06 14:53:00 +09:00
Yukihiro "Matz" Matsumoto
c6a1172592
Add pointer cast to pacify warnings.
2017-01-06 14:52:04 +09:00
Yukihiro "Matz" Matsumoto
9a76a0bd80
Move mrb_assert() position.
2017-01-06 14:51:21 +09:00
Yukihiro "Matz" Matsumoto
f53f73f30c
Should not deallocate shared string referring static; fix #3373
2017-01-06 14:25:01 +09:00
ksss
8a9a24152a
Fix memory error on str_buf_cat
...
Modify from nofree to embed string
2017-01-02 17:32:44 +09:00
ksss
30b6648b9c
Small refactoring: should use RSTR_CAPA
2017-01-02 16:33:58 +09:00
Yukihiro "Matz" Matsumoto
1ed4de58d0
str_buf_cat(): better size check added; ref #3342
2016-12-31 23:33:34 +09:00
Yukihiro "Matz" Matsumoto
342b1de65c
str_buf_cat(): should allocate at least RSTRING_EMBED_LEN_MAX+1.
2016-12-31 23:31:45 +09:00
Yukihiro "Matz" Matsumoto
000a3119ca
Merge pull request #3364 from ksss/string2
...
Check overflow string length
2016-12-25 01:35:44 +09:00
ksss
c626b823ca
Check overflow string length
...
Fix #3360
2016-12-23 23:31:21 +09:00
ksss
0de65a88d4
Do nothing when empty string
...
Fix #3361
2016-12-23 23:13:23 +09:00
Clayton Smith
868d2e528f
Fix crash when exponent is -2147483648
2016-12-15 09:36:22 -05:00
Yukihiro "Matz" Matsumoto
3bedd22d55
Add assertion to make sure new capacity does not overflow.
2016-12-13 10:50:04 +09:00
Yukihiro "Matz" Matsumoto
3a7c369536
Make sure str->capa is under MRB_INT_MAX; fix #3342
2016-12-13 10:48:36 +09:00
Yukihiro "Matz" Matsumoto
92c843dd07
rename prefix RBASIC_ to MRB_; ref #3340
2016-12-12 00:54:36 +09:00
Takashi Kokubun
10bb7ad693
Implement Object#freeze
2016-12-11 03:44:15 +09:00
Felix Jones
2827655b9c
Removed unnecessary const macro - const keyword is already a dependency
2016-12-08 12:38:00 +00:00
Yasuhiro Matsumoto
c27dbfedf4
disable define const on VS
2016-12-08 15:56:50 +09:00
Felix Jones
fe86cf4c91
Removed the errno declaration from string.c
2016-12-07 14:17:09 +00:00
Felix Jones
6187c21bd9
Wrapped string.c errno with ifndef macro for platforms that use inbuilt errno macro
2016-12-07 12:46:47 +00:00
Yukihiro "Matz" Matsumoto
5c651d6ce9
add MRB_API to mrb_float_read(); ref #3270
2016-12-03 18:55:52 +09:00
Yukihiro "Matz" Matsumoto
a0fbc46ccd
Import locale insensitive strtod() from Ruby1.8; fix #3270
...
The function was renamed to `mrb_float_read(const char*, char**)`.
2016-12-03 18:47:04 +09:00
Clayton Smith
76a1bdfa29
Get String length after args in String#chomp!
...
Fixes RCE issue
Reported by @bouk
2016-11-24 10:28:21 -05:00
Tomasz Dąbrowski
1af9e363f2
Fixes for compiling mruby as C++
2016-11-24 09:28:00 +09:00
Yukihiro "Matz" Matsumoto
57900d809f
String#include? does not take integers
2016-11-17 18:02:10 +09:00
Tomasz Dąbrowski
8e0dc6fa8d
Correct argument specifications for few methods:
...
- Struct#values_at
- Module#define_method
- String#chop
- String#chop!
2016-11-16 15:46:28 +01:00