Skip to content

Instantly share code, notes, and snippets.

@clod81
Created October 9, 2017 19:49
Show Gist options
  • Save clod81/6f1b9f3e23ac2d8200fd2139503ce5d9 to your computer and use it in GitHub Desktop.
Save clod81/6f1b9f3e23ac2d8200fd2139503ce5d9 to your computer and use it in GitHub Desktop.
Ruby source main.c for AFL perf improvement
#undef RUBY_EXPORT
#include "ruby.h"
#include "vm_debug.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#ifdef RUBY_DEBUG_ENV
#include <stdlib.h>
#endif
int
main(int argc, char **argv)
{
#ifdef RUBY_DEBUG_ENV
ruby_set_debug_option(getenv("RUBY_DEBUG"));
#endif
#ifdef HAVE_LOCALE_H
setlocale(LC_CTYPE, "");
#endif
ruby_sysinit(&argc, &argv);
RUBY_INIT_STACK;
ruby_init();
void *opts = ruby_options(argc, argv);
#ifdef __AFL_HAVE_MANUAL_CONTROL
__AFL_INIT();
#endif
return ruby_run_node(opts);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment