summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-pack/src
AgeCommit message (Collapse)Author
2021-01-29Remove unnecessary range confirmationdearblue
This is a correction based on the review by @matz. https://github.com/mruby/mruby/pull/5306#pullrequestreview-578378401
2021-01-29Fixed `String#unpack` to handle the highest range of integer valuesdearblue
Previously, problems occurred when the `fixnum` was exceeded. - 32-bit cpu mode with `MRB_WORD_BOXING` and `MRB_INT32`: ```console % bin/mruby -e 'p [0x7fffffff].pack("N").unpack("N")' trace (most recent call last): -e:1: cannot unpack to Integer: 2147483647 (RangeError) ``` - 64-bit cpu mode with `MRB_WORD_BOXING` and `MRB_INT64`: ```console % bin/mruby -e 'p [0x7fffffff_ffffffff].pack("q").unpack("q")' trace (most recent call last): -e:1: cannot unpack to Integer: 9223372036854775807 (RangeError) ```
2020-11-21Rename `MRB_{ENABLE,DISABLE}_` to `MRB_{USE,NO}_`; close #5163KOBAYASHI Shuji
| Previous Name | New Name | |------------------------------|-------------------------| | MRB_ENABLE_ALL_SYMBOLS | MRB_USE_ALL_SYMBOLS | | MRB_ENABLE_SYMBOLL_ALL | MRB_USE_ALL_SYMBOLS | | MRB_ENABLE_CXX_ABI | MRB_USE_CXX_ABI | | MRB_ENABLE_CXX_EXCEPTION | MRB_USE_CXX_EXCEPTION | | MRB_ENABLE_DEBUG_HOOK | MRB_USE_DEBUG_HOOK | | MRB_DISABLE_DIRECT_THREADING | MRB_NO_DIRECT_THREADING | | MRB_DISABLE_STDIO | MRB_NO_STDIO | | ENABLE_LINENOISE | MRB_USE_LINENOISE | | ENABLE_READLINE | MRB_USE_READLINE | | DISABLE_MIRB_UNDERSCORE | MRB_NO_MIRB_UNDERSCORE | | DISABLE_GEMS | MRB_NO_GEMS | * `MRB_ENABLE_SYMBOLL_ALL` seems to be a typo, so it is fixed. * `MRB_` prefix is added to those without. * The previous names can also be used for compatibility.
2020-10-12Change float representation in `mrb` binary files.Yukihiro "Matz" Matsumoto
From human readable (ASCII) string representation to binary dump of IEEE754 in little endian.
2020-10-12Reorganize `Integer` system.Yukihiro "Matz" Matsumoto
- Integrate `Fixnum` and `Integer` - Remove `Integral` - `int / int -> int` - Replace `mrb_fixnum()` to `mrb_int()` - Replace `mrb_fixnum_value()` to `mrb_int_value()`. - Use `mrb_integer_p()` instead of `mrb_fixnum_p()`
2020-10-12Integrate `Fixnum` class into `Integer` classdearblue
* The `Fixnum` constant is now an alias for the `Integer` class. * Remove `struct mrb_state::fixnum_class` member. If necessary, use `struct mrb_state::integer_class` instead.
2020-10-12Rename float configuration option names.Yukihiro "Matz" Matsumoto
- `MRB_WITHOUT_FLOAT` => `MRB_NO_FLOAT` - `MRB_USE_FLOAT` => `MRB_USE_FLOAT32` The former is to use `USE_XXX` naming convention. The latter is to make sure `float` is 32bit float and not floating point number in general.
2020-08-11Fix `mrb_int` and `size_t` combination warnings.Yukihiro "Matz" Matsumoto
2020-08-04Fix wrong condition for `PACK_DIR_HEX`; ref #5057Yukihiro "Matz" Matsumoto
2020-08-03Should not decrement `count` when `PACK_FLAG_COUNT2`; fix #5057Yukihiro "Matz" Matsumoto
2020-04-11Support `MRB_DISABLE_STDIO` for mruby-pack; ref #4954dearblue
2020-03-08Add configuration guard for `MRB_DISABLE_STDIO`dearblue
ref #4576 and ref #4947 * Need MRBAPI functions without `MRB_DISABLE_STDIO`: * mrbgems/mruby-bin-debugger * mrbgems/mruby-bin-mirb * mrbgems/mruby-bin-mrbc * mrbgems/mruby-bin-mruby * mrbgems/mruby-bin-strip * Need `stdio.h`: * mrbgems/mruby-io * mrbgems/mruby-print * Need `snprintf()` in `stdio.h`: * mrbgems/mruby-pack * mrbgems/mruby-sprintf
2020-03-08Remove unnecessary 'stdio.h'; ref #4947dearblue
'stdio.h' is included in 'mruby.h' ('mrbconf.h'). However, keep 'stdio.h' used by mruby-test.
2019-09-25Use inttypes for `snprintf()`dearblue
2019-08-05Use new specifiers/modifiers of `mrb_vfromat()`KOBAYASHI Shuji
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back.
2019-07-14Fix empty array refers; ref #4556dearblue
For example, `"".unpack("")` evaluates to `[]`.
2019-07-14Fix pack/unpack for base64; ref #4556dearblue
The pack/unpack "m" directive should be treated as a length rather than an element count.
2019-06-18Fix path of `error.h`.Hiroshi Mimaki
2019-05-16Avoid potential type mismatch warnings in `pack.c`.Yukihiro "Matz" Matsumoto
2019-05-16Avoid potential integer overflow.Yukihiro "Matz" Matsumoto
2019-03-25Use uppercase version of `ctype` macros e.g. `ISSPACE`; fix #4338Yukihiro "Matz" Matsumoto
2019-01-03pack: Remove redundant float check in pack_utf8()KOBAYASHI Shuji
The argument is converted to fixnum before calling.
2018-12-22Define byte order macros, if not defined it and there are alternativesdearblue
2018-12-21Fixed a bug on platforms without `BYTE_ORDER`; ref #4190Yukihiro "Matz" Matsumoto
2018-12-21`mruby-pack` should not rely on `MRB_ENDIAN_BIG` macro; fix #4190Yukihiro "Matz" Matsumoto
The `MRB_ENDIAN_BIG` macro is originally used for `NaN` boxing. We cannot assume it is defined on every big endian platform (#4190 is the case). So instead of relying on untrusted `MRB_ENDIAN_BIG`, we use `BYTE_ORDER` macro with a fallback function to check endian in runtime.
2018-11-19Remove implicit conversion using `to_int` method.Yukihiro "Matz" Matsumoto
The ISO standard does not include implicit type conversion using `to_int`. This implicit conversion often causes vulnerability. There will be no more attacks like #4120. In addition, we have added internal convenience method `__to_int` which does type check and conversion (from floats).
2018-11-01Silence Appveyor's VC compilation warnings.Yukihiro "Matz" Matsumoto
2018-09-18Use `mrb_to_flo()` to check return value from `to_f`; fix #4115Yukihiro "Matz" Matsumoto
The ISO standard does not include implicit type conversion using `to_int`, `to_str` and sometimes `to_f`. For the compactness of the mruby implementation, maybe we should remove those implicit conversion from mruby.
2018-09-07Add a new method `unpack1` to `mruby-pack` gem.Yukihiro "Matz" Matsumoto
2018-09-07Fix heap buffer overflow in `unpack_a`; fix #4103Yukihiro "Matz" Matsumoto
2018-06-15Fixed wrong usages of `mrb_raisef()`; ref #4043Yukihiro "Matz" Matsumoto
`mrb_raisef()` only takes `%S` specifier. If you don't have extra arguments, use `mrb_raise()`.
2018-03-02Round up the `dstlen` value; fix #3949Yukihiro "Matz" Matsumoto
The fix was proposed by https://hackerone.com/aerodudrizzt
2018-02-13Check `sizeof(base64_dec_tab)` in base64 encoding; fix #3947Yukihiro "Matz" Matsumoto
The issue (and the fix) reported by https://hackerone.com/aerodudrizzt
2018-02-13Check negative offset in `pack` method; fix #3944Yukihiro "Matz" Matsumoto
2018-02-13Fixed wrong offset in `pack_x` function; ref #3944Yukihiro "Matz" Matsumoto
2018-02-13Use 'mrb_raise` instead of `mrb_raisef` when no argument given.Yukihiro "Matz" Matsumoto
2018-02-10Check negative `count` in `pack_x` and `unpack_x`; fix #3944Yukihiro "Matz" Matsumoto
2018-02-09Check if `mruby-pack` template count overflow; fix #3942Yukihiro "Matz" Matsumoto
2017-12-13Reduce VC++ type mismatch warnings.Yukihiro "Matz" Matsumoto
2017-12-12Do not use `FIXABLE` when `mrb_int` is big enough.Yukihiro "Matz" Matsumoto
2017-12-12Reduce type mismatch warnings in pack.c.Yukihiro "Matz" Matsumoto
2017-12-12Fixed the mixture of `int` and `long` in `mruby-pack`.Yukihiro "Matz" Matsumoto
2017-12-12Support MRB_WITHOUT_FLOAT to mruby-io and mruby-packYusuke Endoh
2017-12-11Reduce VC++ compiler warnings.Yukihiro "Matz" Matsumoto
2017-12-09Reduce VC++ compiler warnings.Yukihiro "Matz" Matsumoto
2017-12-07Avoid uninitialized local variables in `mruby-pack`.Yukihiro "Matz" Matsumoto
2017-12-07Add 'mrbgems/mruby-pack/' from commit '383a9c79e191d524a9a2b4107cc5043ecbf6190b'Yukihiro "Matz" Matsumoto
git-subtree-dir: mrbgems/mruby-pack git-subtree-mainline: 842e6945f2d0a519d7cf0525016830246cd337ab git-subtree-split: 383a9c79e191d524a9a2b4107cc5043ecbf6190b