state.c: check irep reference count overflow.
MODIFY
src/state.c
src/state.c
** See Copyright Notice in mruby.h
*/
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <mruby.h>
@@ -110,6 +111,12 @@ void
mrb_irep_incref(mrb_state *mrb, mrb_irep *irep)
{
if (irep->flags & MRB_IREP_NO_FREE) return;
+ if (irep->refcnt == UINT16_MAX) {
+ mrb_garbage_collect(mrb);
+ if (irep->refcnt == UINT16_MAX) {
+ mrb_raise(mrb, E_RUNTIME_ERROR, "too many irep references");
+ }
+ }
irep->refcnt++;
}

state.c: check irep reference count overflow.