Sha256: d9474470fb8ac2689390f0c2dfbb4f6a3a9ba755715d459f4669db4051788fc8
Contents?: true
Size: 1.93 KB
Versions: 11
Compression:
Stored size: 1.93 KB
Contents
/* Copyright (c) 2020 Contrast Security, Inc. See * https://www.contrastsecurity.com/enduser-terms-0317a for more details. */ #include "cs__assess_regexp.h" #include "../cs__common/cs__common.h" #include <ruby.h> void contrast_alias_method(const VALUE target, const char *to, const char *from); static VALUE contrast_assess_regexp_equal_squiggle(const int argc, const VALUE *argv, const VALUE regexp) { VALUE result, infohash; result = rb_funcall2(regexp, rb_sym_assess_regexp_equal_squiggle, argc, argv); if (RTEST(result)) { infohash = rb_hash_new(); rb_hash_aset(infohash, rb_sym_regexp, regexp); rb_hash_aset(infohash, rb_sym_result, result); rb_hash_aset(infohash, rb_sym_string, argv[0]); rb_hash_aset(infohash, rb_sym_back_ref, rb_backref_get()); rb_funcall(regexp_propagator, rb_sym_assess_track_regexp, 1, infohash); } return result; } void Init_cs__assess_regexp(void) { regexp_propagator = rb_define_class_under(core_assess, "RegexpPropagator", rb_cObject); rb_sym_assess_track_regexp = rb_intern("track_equal_squiggle"); /* These are the keys we use to define our hash of * Regexp info. rb_global_variable doesn't make * them global in the $global sense, but marks them * so they don't get swept by the GC. */ rb_sym_result = ID2SYM(rb_intern("result")); rb_global_variable(&rb_sym_result); rb_sym_regexp = ID2SYM(rb_intern("regexp")); rb_global_variable(&rb_sym_regexp); rb_sym_string = ID2SYM(rb_intern("string")); rb_global_variable(&rb_sym_string); rb_sym_back_ref = ID2SYM(rb_intern("back_ref")); rb_global_variable(&rb_sym_back_ref); rb_sym_assess_regexp_equal_squiggle = contrast_register_patch( "Regexp", "=~", contrast_assess_regexp_equal_squiggle); }
Version data entries
11 entries across 11 versions & 1 rubygems