Commit Graph

66 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto f1523d2404 Squashed commit of the following:
commit 2d7d545c4c4bfce7fdcbcbe9baaeb437915742f0
Merge: 625a1249 b178914b
Author: Yukihiro "Matz" Matsumoto <matz@ruby.or.jp>
Date:   Fri Jun 5 14:35:13 2020 +0900

    Merge branch 'fix-mrb_open-with-nomem' of https://github.com/dearblue/mruby into dearblue-fix-mrb_open-with-nomem

commit b178914b11
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sat Jan 19 22:22:44 2019 +0900

    Fix invalid pointer free inside other heap's block

     1. `e = mrb_obj_alloc(...)`
     2. `e->stack = mrb->c->stack` (`mrb->c->stack` is anywhere in the range `stbase...stend`)
     3. And raised exception by `mrb_malloc()`!
     4. `mrb_free(e->stack)` by GC part (wrong free)

commit 52e3d5d858
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sat Jan 19 21:55:36 2019 +0900

    Fix memory leak for temporary symbols when out of memory

commit 4c5499b88e
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 11:42:07 2019 +0900

    Fix uninitialized pointer dereference for debug section

commit 8e993167de
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 11:41:09 2019 +0900

    Fix memory leak for temporary filenames when out of memory

commit 8b422577e6
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 10:57:51 2019 +0900

    Fix memory leak for irep when out of memory

commit 6b35ebf49a
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 10:55:50 2019 +0900

    Fix uninitialized pointer dereference when do not finished initializing irep

commit 2531f2631e
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 10:48:15 2019 +0900

    Fix NULL pointer dereference when do not finished initializing irep

commit e2d6896eba
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sat Jan 19 12:54:19 2019 +0900

    Fix memory leak for irep when out of memory by `mrb_proc_new()`

commit b6214ff8a0
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sat Jan 19 12:53:07 2019 +0900

    Fix memory leak for `khash_t` in `kh_init_size()` when out of memory by `kh_alloc()`

commit 19162dd6c1
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 02:15:07 2019 +0900

    Fix memory leak for symbol string when out of memory in `kh_put()`

commit 15e67297ff
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 02:12:24 2019 +0900

    Fix keep wrong symbol index when out of memory

commit 3f8e2b3752
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 02:08:13 2019 +0900

    Fix keep wrong symbol capacity when out of memory

commit a3cfe755ab
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sat Jan 19 10:11:37 2019 +0900

    Fix NULL pointer dereference `mrb->c` by `mark_context()`

commit d9c7b6be6e
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 15:25:09 2019 +0900

    Fix protect exception for print error message

commit 100642750e
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 11:59:02 2019 +0900

    Protect exception for mruby core initialization

commit 7a0418304e
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Fri Jan 18 20:38:27 2019 +0900

    Fix memory leak for string object when out of memory

    The `mrb_str_pool()` function has a path to call `malloc()` twice.

    If occurs `NoMemoryError` exception in second `malloc()`,
    first `malloc()` pointer is not freed.

commit fef1c152ce
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sat Jan 19 13:05:09 2019 +0900

    Fix stack overflow when out of memory

    As a result of this change, no backtrace information is set
    for NoMemoryError (`mrb->nomem_err`).

    Detailes:

    When generating a backtrace, called `mrb_intern_lit()`,
    `mrb_str_new_cstr()` and `mrb_obj_iv_set()` function with
    `exc_debug_info()` function in `src/error.c`.

    If a `NoMemoryError` exception occurs at this time,
    the `exc_debug_info()` function will be called again,
    and in the same way `NoMemoryError` exception raised will result
    in an infinite loop to occurs stack overflow (and SIGSEGV).

commit da7d7f881b
Author: dearblue <dearblue@users.noreply.github.com>
Date:   Sun Jan 20 12:00:38 2019 +0900

    Fix NULL pointer dereference `mrb->nomem_err` when not initialized

    Add internal functions (not `static`):

      * `mrb_raise_nomemory()`
      * `mrb_core_init_abort()`
2020-06-05 14:40:07 +09:00
David Siaw b5299b1c58 fix up documentation for values 2019-08-18 20:12:44 +09:00
Yukihiro "Matz" Matsumoto 065966dae4 common.h are supposed to be included from other header, so call it with quotes; ref #3032 2015-11-28 00:10:38 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Seba Gamboa a0fe0c40b1 Remove old doxygen tags 2015-10-08 12:29:10 -03:00
Seba Gamboa 40bf7bde78 Sorting documentation grouping 2015-09-21 01:48:42 -03:00
Seba Gamboa c127614638 Setting up doxygen groups 2015-09-20 21:14:07 -03:00
Yukihiro "Matz" Matsumoto bb3447173b khash.h: keep key/value table accessible from original hashtable during resize; fix #2682 2014-12-23 22:28:33 +09:00
Tatsuhiko Kubo 3b904e9408 Unify include guard styles and header comments. 2014-08-21 13:27:37 +09:00
yui-knk 45305686fe Add a space aftre bracket. 2014-05-18 19:40:17 +09:00
mirichi d3efe18143 do not reuse deleted entry. fixed 2014-04-20 23:10:24 +09:00
Yukihiro "Matz" Matsumoto ac5091e211 use quadratic probing in khash.h 2014-04-13 18:30:22 +09:00
Yukihiro "Matz" Matsumoto 6d6ae570cb add kh_push2() to check if entry is added 2014-04-13 18:20:37 +09:00
Yukihiro "Matz" Matsumoto 45eccd1333 khash.h: use first found k_del 2014-04-13 00:32:23 +09:00
ksss 91f68f77a8 kh_put return value should be found index 2014-04-11 21:13:43 +09:00
ksss b6cfe0e001 Fix bug kh_put after kh_del report by @mirichi 2014-04-11 19:32:32 +09:00
ksss 93904fee21 Refactoring for kh_put 2014-04-10 08:48:34 +09:00
Yukihiro "Matz" Matsumoto aecdafb9ce kh_put in khash.h should work when direct bucket is deleted one 2014-04-10 00:53:32 +09:00
Yukihiro "Matz" Matsumoto 8389066272 Merge pull request #2036 from ksss/assert-kh_del
add assert before write khash del flags
2014-04-10 00:16:32 +09:00
Yukihiro "Matz" Matsumoto 020116fa6b revert 40eaf705 for performance reason; ref #2022 2014-04-10 00:14:57 +09:00
ksss cf5aabeba1 add assert before write khash del flags 2014-04-09 23:11:37 +09:00
Yukihiro "Matz" Matsumoto 0d9cc9ccc6 Merge pull request #2023 from ksss/khash-readable
Use kh_end instead to n_buckets
2014-04-06 23:19:40 +09:00
ksss f946465fe4 Use kh_end instead to n_buckets 2014-04-06 13:45:32 +00:00
ksss 40eaf7058c Delete khash_mask macro.
And fix expression to more simple and readable.
2014-04-06 13:26:10 +00:00
Yukihiro "Matz" Matsumoto fc2b37f0ee space adjustment in khash.h 2014-04-03 20:35:27 +09:00
ksss 169cf75b1e delete khash member upper_bound 2014-04-03 11:26:37 +00:00
ksss 84ccc82ef9 Delete khash member mask and inc
because there can be substituted by n_buckets
2014-04-02 15:42:31 +00:00
ksss 0f1a984a4f use size_t instead of int 2014-04-02 13:24:50 +00:00
ksss c816558b01 delete unused indexes __m_* masks 2014-04-02 12:44:11 +00:00
Yukihiro "Matz" Matsumoto 3e24e06b29 add a space after C reserved words 2014-03-18 23:57:29 +09:00
take_cheeze 23ef20624c fix compile error 2014-03-01 20:05:29 +09:00
take_cheeze 78915f9601 support c++ exception 2014-03-01 20:05:29 +09:00
cubicdaiya 67de10bfcb use C style comments instead of C++ style comments
According to CONTRIBUTING.md,

Don't use C++ style comments

 /* This is the prefered comment style */

Use C++ style comments only for temporary comment e.g. commenting out some code lines.
2014-03-01 03:31:45 +09:00
crimsonwoods 370ad6fade Remove 'mrb_state' field from 'kh_xxx_t' structure.
'kh_xxx_t' requires 'mrb_state' to allocate, free, and compute hash value.
But 'mrb_state' should not be held by 'kh_xxx_t' and 'mrb_state' should be
supplied from outside.
2013-12-23 00:33:07 -08:00
h2so5 88758e3630 Uniquify the results of Object#methods 2013-10-27 04:04:06 +09:00
Yukihiro "Matz" Matsumoto b8a46227ee put pointer tables before bitmap to avoid alignment issues; ref #1353 2013-07-10 13:14:40 +09:00
mirichi cdb23edf31 It optimizes more. 2013-07-07 22:17:44 +09:00
mirichi 550905000c kh_resize_##name bug fixed. 2013-07-07 09:23:50 +09:00
mirichi 00353a3c42 khash optimize 2013-07-06 09:10:42 +09:00
Yukihiro Matz Matsumoto 8ae0c58bb0 resolve conflict from #1017 2013-03-17 00:28:49 +09:00
Masaki Muranaka 6ba298ed54 Remove unnecessory stdint.h. 2013-03-16 21:06:32 +09:00
Masaki Muranaka 715270bec5 Include mruby.h. As KHASH_DEFAULT_SIZE might be defined in mrbconf.h. 2013-03-16 21:06:03 +09:00
Masaki Muranaka 7de2deab1e Remove string.h in khash.h 2013-03-16 17:48:30 +09:00
Masaki Muranaka 1bb447a7d3 Avoid to call memset(). Use the new function kh_fill_flags() instead. This is for compatibility. 2013-03-16 17:00:44 +09:00
Masaki Muranaka 591dbbf13f Change the place of the close parenthesis. Even though it probably cause no bugs for current code. 2013-03-16 16:58:14 +09:00
Masamitsu MURASE 54eb08e2fc Remove ";" suffix from function-type macros. 2013-02-02 00:24:30 +09:00
takkaw 06dac3fba0 fix typos 2013-01-13 15:28:03 +09:00
Yukihiro Matsumoto 7d02df3016 NaN boxing 2012-08-14 13:16:34 +09:00
Yukihiro Matsumoto 515862cc01 khash refactoring; no more MRB_KHASH_INITIAL_SIZE 2012-07-30 23:55:35 +09:00
Yukihiro Matsumoto e75c76ecee iv khash initial size to 8 2012-07-30 17:16:05 +09:00