text
stringlengths
79
3.72M
<vulnerable_code> Iterator, yields Block objects. """ def __init__(self, input, language, *, verify=True): """ "input" should be a str object with embedded \n characters. self.find_start_re = create_regex(before, after, whole_line=False) self.start_re = create_regex(b...
<vulnerable_code> Any whitespace that can be uniformly removed from the second line onwards is removed.""" try: lines = doc.expandtabs().split('\n') except UnicodeError: return None else: # Find minimum indentation of any non-blank lines after first line. margin = sys...
<vulnerable_code>treated as equal: >>> def f(x): ... '>>> print(1, 2, 3)\n 1 2\n 3' >>> # Without the flag: >>> test = doctest.DocTestFinder().find(f)[0] >>> doctest.DocTestRunner(verbose=False).run(test) ... # doctest: +ELLIPSIS *****************************************************...
<vulnerable_code> self.assertEqual(finddoc(int.from_bytes), int.from_bytes.__doc__) self.assertEqual(finddoc(int.real), int.real.__doc__) def test_cleandoc(self): self.assertEqual(inspect.cleandoc('An\n indented\n docstring.'), 'An\nindented\ndocstring.') ...
<vulnerable_code>#include "pycore_atomic_funcs.h" // _Py_atomic_int_get() #include "pycore_bitutils.h" // _Py_bswap32() #include "pycore_bytesobject.h" // _PyBytes_Find() #include "pycore_compile.h" // _PyCompile_CodeGen, _PyCompile_OptimizeCfg, _PyCompile_Assemble #include "pycore_ceval.h" // _PyEval_...
<vulnerable_code> if (c->c_optimize < 2) { docstring = _PyAST_GetDocString(stmts); if (docstring) { i = 1; st = (stmt_ty)asdl_seq_GET(stmts, 0); assert(st->kind == Expr_kind); VISIT(c, expr, st->v.Expr.value); RETURN_IF_ERROR(compiler_nameop...
<vulnerable_code>import unittest import string import zipfile from ._functools import compose big_o = import_or_skip('big_o') class TestComplexity(unittest.TestCase): def test_implied_dirs_performance(self): best, others = big_o.big_o( compose(consume, zipfile.CompleteDirs._implied_dirs), ...
<vulnerable_code> │ ├── d │ │ └── e.txt │ └── f.txt └── g └── h └── i.txt This fixture has the following key characteristics: - a file two levels deep (b/d/e) - multiple files in a directory (b/c, b/f) - a directory containing only a directory (g/h) "alp...
<vulnerable_code><commit_title>[PATCH 04/19] gh-106446: Fix failed doctest in stdtypes (#106447)<commit_description><fixed_code> from . import test_path __name__ == '__main__' and test_path.build_alpharep_fixture().extractall('alpharep')
<vulnerable_code>import contextlib import pathlib import re import fnmatch __all__ = ['Path'] encoding, args, kwargs = _extract_text_encoding(*args, **kwargs) return io.TextIOWrapper(stream, encoding, *args, **kwargs) @property def name(self): return pathlib.Path(self.at).name or self...
<vulnerable_code><commit_title>[PATCH 04/19] gh-106446: Fix failed doctest in stdtypes (#106447)<commit_description><fixed_code> import re def translate(pattern): r""" Given a glob pattern, produce a regex that matches it. >>> translate('*.txt') '[^/]*\\.txt' >>> translate('a?txt') 'a.txt' ...
<vulnerable_code> clone_info=(CacheInfo *) AcquirePixelCache(cache_info->number_threads); if (clone_info == (Cache) NULL) return((Cache) NULL); clone_info->virtual_pixel_method=cache_info->virtual_pixel_method; return((Cache ) clone_info); } *magick_restrict cache_info, *magick_restrict clone_info;...
<vulnerable_code>#if defined(RENDERER_AGG) typedef agg::renderer_scanline_aa_solid<renderer_base_t> renderer_t; agg::rendering_buffer rbuf(&buffer_[0], width, height, width); pixfmt_t pixfmt(rbuf); renderer_base_t renderer_base(pixfmt); agg::scanline_p8 scanline;<commit_title>[PATCH] #70 Fix for bug 2<commit...
<vulnerable_code> membersUtility.db.collection('members').findOne({"email": email}, function(err, member) { if (member) { var timestamp = Math.round(new Date().getTime() / 1000), prid = sha512Hash(member.username + member.full_name, timestamp); memb...
<vulnerable_code> } source += aoffset; } else { if (buf->offset < aoffset) { debug_print("%s", "End of buffer\n"); buf->error = MOBI_BUFFER_END; return; }<commit_title>[PATCH] fix oob write bug inside libmobi<commit_description><fixed_code> ...
<vulnerable_code> u16 pSize; GF_TextSampleEntryBox *ptr = (GF_TextSampleEntryBox*)s; ISOM_DECREASE_SIZE(ptr, 51); e = gf_isom_base_sample_entry_read((GF_SampleEntryBox *)ptr, bs); if (e) return e; ptr->displayFlags = gf_bs_read_u32(bs); /*Display flags*/ ptr->textJustification = gf_bs_read_u32(bs); /*Text ju...
<vulnerable_code> payload_start = gf_bs_get_position(bs); retry_unknown_box: end = gf_bs_available(bs); if (size - hdr_size > end ) { newBox->size = size - hdr_size - end; gf_isom_box_del(newBox); *outBox = NULL; if (parent_type==GF_ISOM_BOX_TYPE_STSD) { newBox = gf_isom_box_new(GF_ISOM_BOX_TYPE_UNKNOW...
<vulnerable_code> #ifndef GPAC_DISABLE_ISOM GF_Err gf_isom_get_text_description(GF_ISOFile *movie, u32 trackNumber, u32 descriptionIndex, GF_TextSampleDescriptor **out_desc) { GF_TrackBox *trak; u32 i; Bool is_qt_text = GF_FALSE; GF_Tx3gSampleEntryBox *txt; if (!descriptionIndex || !out_desc) return GF_BAD_PARA...
<vulnerable_code> bn_t a, b, c, d[3], e[3]; crt_t crt; dig_t f; int len; bn_null(a); bn_null(b); BENCH_RUN("bn_rec_naf") { int8_t naf[RLC_BN_BITS + 1]; int len; bn_rand(a, RLC_POS, RLC_BN_BITS); BENCH_ADD((len = RLC_BN_BITS + 1, bn_rec_naf(naf, &len, a, 4))); } if (eb_param_set_any_kbltz() == RLC_OK) ...
<vulnerable_code> dig_t in, new; uint8_t out[RLC_BN_BITS / 8 + 1]; size_t out_len; bdpe_null(pub); bdpe_null(prv); bdpe_new(pub); bdpe_new(prv); BENCH_ONE("cp_bdpe_gen", cp_bdpe_gen(pub, prv, bn_get_prime(47), RLC_BN_BITS), 1); BENCH_RUN("cp_bdpe_enc") { out_len = RLC_BN_BITS / 8 + 1; rand_bytes(out, 1...
<vulnerable_code>static void memory2(void) { ep2_t a[BENCH]; BENCH_FEW("ep2_null", ep4_null(a[i]), 1); BENCH_FEW("ep2_new", ep4_new(a[i]), 1); for (int i = 0; i < BENCH; i++) { ep2_free(a[i]); } for (int i = 0; i < BENCH; i++) { ep2_new(a[i]); } BENCH_FEW("ep2_free", ep4_free(a[i]), 1); (void)a; }<commi...
<vulnerable_code> bn_abs(y, a); } while (y->used > 1) { bn_rsh(u, x, bn_bits(x) - RLC_DIG); _x = u->dp[0]; bn_rsh(v, y, bn_bits(x) - RLC_DIG); _y = v->dp[0]; _a = _d = 1; _b = _c = 0; bn_copy(x, y); bn_copy(y, t0); } else { bn_rsh(u, x, bn_bits(x) - 2 * RLC_DIG); bn_rsh(v, y, ...
<vulnerable_code>/* Public definitions */ /*============================================================================*/ void bn_make(bn_t a, int digits) { if (digits < 0) { RLC_THROW(ERR_NO_VALID); } } } void bn_grow(bn_t a, int digits) { #if ALLOC == DY...
<vulnerable_code> void bn_mxp_slide(bn_t c, const bn_t a, const bn_t b, const bn_t m) { bn_t tab[RLC_TABLE_SIZE], t, u, r; int i, j, l, w = 1; uint8_t *win = RLC_ALLOCA(uint8_t, bn_bits(b)); if (win == NULL) { bn_null(u); bn_null(r); /* Initialize table. */ for (i = 0; i < RLC_TABLE_SIZE; i++) { bn_null(tab[...
<vulnerable_code> bn_sub_dig(n1, a, 1); bn_copy(r, n1); s = 0; while (bn_is_even(r)) { s++; bn_rsh(r, r, 1); } #if BN_GEN == BASIC || !defined(STRIP) void bn_gen_prime_basic(bn_t a, int bits) { while (1) { do { bn_rand(a, RLC_POS, bits); #if BN_GEN == SAFEP || !defined(STRIP) void bn_gen_prime_...
<vulnerable_code> * @param[in] to - the last bit position, inclusive. * @return the bits in the chosen positions. */ static char get_bits(const bn_t a, int from, int to) { int f, t; dig_t mf, mt; /* Public definitions */ /*==================================...
<vulnerable_code> bn_trim(c); } void bn_lsh(bn_t c, const bn_t a, int bits) { int digits; dig_t carry; bn_copy(c, a); if (bits <= 0) { return; } RLC_RIP(bits, digits, bits); RLC_TRY { } } void bn_rsh(bn_t c, const bn_t a, int bits) { int digits = 0; bn_copy(c, a); if (bits <= 0) { return; } RL...
<vulnerable_code> } /* Write t0 as 2^h * t0. */ h = 0; while (bn_is_even(t0)) { h++; bn_rsh(t0, t0, 1); }<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> } /* Write t0 as 2^h * t0. */ h = 0; while (bn_is_even(t0) && !bn_i...
<vulnerable_code> void bn_srt(bn_t c, bn_t a) { bn_t h, l, m, t; int bits, cmp; if (bn_sign(a) == RLC_NEG) { RLC_THROW(ERR_NO_VALID); bn_new(m); bn_new(t); bn_set_2b(h, bits >> 1); bn_set_2b(l, (bits >> 1) - 1); /* Trivial binary search approach. */ do {<commit_title>[PATCH] Huge commit improving th...
<vulnerable_code> return 0; } int bn_bits(const bn_t a) { int bits; if (bn_is_zero(a)) { return bits + util_bits_dig(a->dp[a->used - 1]); } int bn_get_bit(const bn_t a, int bit) { int d; if (bit < 0) { } } void bn_set_bit(bn_t a, int bit, int value) { int d; if (bit < 0) { } } int bn_ham(const bn_t a) {...
<vulnerable_code> return result; } int cp_bls_sig(g1_t s, const uint8_t *msg, int len, const bn_t d) { g1_t p; int result = RLC_OK; <commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> return result; } int cp_bls_sig(g1_t s, const uint8_t *msg, size_t le...
<vulnerable_code> pc_map(gt, g1, g2); rand_bytes(prf, plen); if (bls) { cp_bls_gen(sk, pk); } else { cp_ecdsa_gen(sk, g1); fp_copy(pk->x[0], g1->x); fp_copy(pk->y[0], g1->y); } /* Generate elements for n tags. */ for (int i = 0; i < len; i++) { gt_exp(hs[i], gt, x[i]); } bn_rand_mod(d...
<vulnerable_code> bn_free(_x[i]); } RLC_FREE(p); } return result; }<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> bn_free(_x[i]); } RLC_FREE(p); RLC_FREE(_x); } return result; }
<vulnerable_code> * @param[in] operation - flag to indicate the operation type. * @return RLC_ERR if errors occurred, RLC_OK otherwise. */ static int pad_pkcs1(bn_t m, int *p_len, int m_len, int k_len, int operation) { uint8_t *id, pad = 0; int len, result = RLC_ERR; bn_t t; bn_null(t); RLC_TRY { bn_new(t); ...
<vulnerable_code> int cp_sokaka_key(uint8_t *key, size_t key_len, const char *id1, const sokaka_t k, const char *id2) { int len1 = strlen(id1), len2 = strlen(id2); int size, first = 0, result = RLC_OK; uint8_t *buf; g1_t p; g2_t q;<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<...
<vulnerable_code>int cp_vbnn_gen_prv(bn_t sk, ec_t pk, const bn_t msk, const uint8_t *id, size_t id_len) { uint8_t hash[RLC_MD_LEN]; int len, result = RLC_OK; uint8_t *buf = NULL; bn_t n, r; /* zero variables */ bn_null(n); int cp_vbnn_sig(ec_t r, bn_t z, bn_t h, const uint8_t *id, size_t id_len, const uint...
<vulnerable_code>/* Public definitions */ /*============================================================================*/ void eb_map(eb_t p, const uint8_t *msg, int len) { bn_t k; fb_t t0, t1; int i;<commit_title>[PATCH] Huge commit improving the API to use ...
<vulnerable_code> * @param[in] k - the integer. */ static void eb_mul_ltnaf_imp(eb_t r, const eb_t p, const bn_t k) { int i, l, n; int8_t tnaf[RLC_FB_BITS + 8], u; eb_t t[1 << (EB_WIDTH - 2)]; if (eb_curve_opt_a() == RLC_ZERO) { u = -1; * @param[in] k - the integer. */ static void eb_mul_lnaf_imp(eb_t...
<vulnerable_code> */ static void eb_mul_sim_kbltz(eb_t r, const eb_t p, const bn_t k, const eb_t q, const bn_t m, const eb_t *t) { int i, l, l0, l1, n0, n1, w, g; int8_t u, tnaf0[RLC_FB_BITS + 8], tnaf1[RLC_FB_BITS + 8], *_k, *_m; eb_t t0[1 << (EB_WIDTH - 2)]; eb_t t1[1 << (EB_WIDTH - 2)]; for (i = 0; i < (1 <...
<vulnerable_code> return size; } void eb_read_bin(eb_t a, const uint8_t *bin, int len) { if (len == 1) { if (bin[0] == 0) { eb_set_infty(a); } } void eb_write_bin(uint8_t *bin, int len, const eb_t a, int pack) { eb_t t; eb_null(t);<commit_title>[PATCH] Huge commit improving the API to use size_t instead of ...
<vulnerable_code>/* Public definitions */ /*============================================================================*/ void ed_map_dst(ed_t p, const uint8_t *msg, int len, const uint8_t *dst, int dst_len) { bn_t k; fp_t t; ed_t q; } } void ed_map(ed_t p,...
<vulnerable_code>#if ED_MUL == LWNAF || !defined(STRIP) static void ed_mul_naf_imp(ed_t r, const ed_t p, const bn_t k) { int l, i, n; int8_t naf[RLC_FP_BITS + 1]; ed_t t[1 << (ED_WIDTH - 2)]; if (bn_is_zero(k)) { ed_set_infty(r); static void ed_mul_reg_imp(ed_t r, const ed_t p, const bn_t k) { bn_t _k; int i...
<vulnerable_code> * @param[in] k - the integer. */ static void ed_mul_fix_plain(ed_t r, const ed_t * t, const bn_t k) { int l, i, n; int8_t naf[RLC_FP_BITS + 1], *_k; /* Compute the w-TNAF representation of k. */ l = RLC_FP_BITS + 1;<commit_title>[PATCH] Huge commit improving the API to use size_t instead of ...
<vulnerable_code> */ static void ed_mul_sim_plain(ed_t r, const ed_t p, const bn_t k, const ed_t q, const bn_t m, const ed_t *t) { int i, l, l0, l1, n0, n1, w, gen; int8_t naf0[RLC_FP_BITS + 1], naf1[RLC_FP_BITS + 1], *_k, *_m; ed_t t0[1 << (ED_WIDTH - 2)]; ed_t t1[1 << (ED_WIDTH - 2)]; RLC_TRY { gen = (t == ...
<vulnerable_code> return size; } void ed_read_bin(ed_t a, const uint8_t *bin, int len) { if (len == 1) { if (bin[0] == 0) { ed_set_infty(a); } } void ed_write_bin(uint8_t *bin, int len, const ed_t a, int pack) { ed_t t; ed_null(t);<commit_title>[PATCH] Huge commit improving the API to use size_t instead of ...
<vulnerable_code> * @param[in] coeffs - the vector of coefficients in the polynomial. * @param[in] deg - the degree of the polynomial. */ TMPL_MAP_HORNER(fp, fp_st) /** * Generic isogeny map evaluation for use with SSWU map. */ TMPL_MAP_ISOGENY_MAP(ep, fp, iso) #endif /* EP_CTMAP */ /** * Simplified SWU mappin...
<vulnerable_code>#if defined(EP_ENDOM) static void ep_mul_glv_imp(ep_t r, const ep_t p, const bn_t k) { int l, l0, l1, i, n0, n1, s0, s1; int8_t naf0[RLC_FP_BITS + 1], naf1[RLC_FP_BITS + 1], *t0, *t1; bn_t n, _k, k0, k1, v1[3], v2[3]; ep_t q, t[1 << (EP_WIDTH - 2)]; bn_null(n); bn_null(_k); #if defined(EP_PLAIN...
<vulnerable_code> * @param[in] k - the integer. */ static void ep_mul_fix_plain(ep_t r, const ep_t *t, const bn_t k) { int l, i, n; int8_t naf[RLC_FP_BITS + 1]; /* Compute the w-TNAF representation of k. */ l = RLC_FP_BITS + 1;<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<c...
<vulnerable_code> */ static void ep_mul_sim_endom(ep_t r, const ep_t p, const bn_t k, const ep_t q, const bn_t m, const ep_t *t) { int i, l, l0, l1, l2, l3, sk0, sk1, sl0, sl1, w, g = 0; int8_t naf0[RLC_FP_BITS + 1], naf1[RLC_FP_BITS + 1], *t0, *t1, u; int8_t naf2[RLC_FP_BITS + 1], naf3[RLC_FP_BITS + 1], *t2, *t3;...
<vulnerable_code> return size; } void ep_read_bin(ep_t a, const uint8_t *bin, int len) { if (len == 1) { if (bin[0] == 0) { ep_set_infty(a); } } void ep_write_bin(uint8_t *bin, int len, const ep_t a, int pack) { ep_t t; ep_null(t);<commit_title>[PATCH] Huge commit improving the API to use size_t instead of ...
<vulnerable_code> * @param[in] len - the degree of the polynomial. */ TMPL_MAP_HORNER(fp2, fp2_t) /** * Generic isogeny map evaluation for use with SSWU map. */ TMPL_MAP_ISOGENY_MAP(ep2, fp2, iso2) #endif /* EP_CTMAP */ /** * Simplified SWU mapping. */ #define EP2_MAP_COPY_COND(O, I, C) ...
<vulnerable_code>#if defined(EP_ENDOM) static void ep2_mul_glv_imp(ep2_t r, const ep2_t p, const bn_t k) { int i, j, l, _l[4]; bn_t n, _k[4], u; int8_t naf[4][RLC_FP_BITS + 1]; ep2_t q[4]; RLC_TRY { bn_new(n); bn_new(u); for (i = 0; i < 4; i++) { bn_null(_k[i]); ep2_null(q[i]); bn_new(_k[i]); ep2...
<vulnerable_code> * @param[in] k - the integer. */ static void ep2_mul_fix_plain(ep2_t r, const ep2_t *table, const bn_t k) { int len, i, n; int8_t naf[2 * RLC_FP_BITS + 1], *t; if (bn_is_zero(k)) { ep2_set_infty(r); t = naf + len - 1; ep2_set_infty(r); for (i = len - 1; i >= 0; i--, t--) { ep2_dbl(r, ...
<vulnerable_code> */ static void ep2_mul_sim_endom(ep2_t r, const ep2_t p, const bn_t k, ep2_t q, const bn_t m) { int i, j, l, _l[4]; bn_t _k[4], _m[4], n, u; int8_t naf0[4][RLC_FP_BITS + 1]; int8_t naf1[4][RLC_FP_BITS + 1]; RLC_TRY { bn_new(n); bn_new(u); for (i = 0; i < 4; i++) { bn_null(_k[i]); bn...
<vulnerable_code> return size; } void ep2_read_bin(ep2_t a, const uint8_t *bin, int len) { if (len == 1) { if (bin[0] == 0) { ep2_set_infty(a); } } void ep2_write_bin(uint8_t *bin, int len, const ep2_t a, int pack) { ep2_t t; ep2_null(t);<commit_title>[PATCH] Huge commit improving the API to use size_t inst...
<vulnerable_code>/* Public definitions */ /*============================================================================*/ void ep4_map(ep4_t p, const uint8_t *msg, int len) { bn_t x; fp4_t t0; uint8_t digest[RLC_MD_LEN];<commit_title>[PATCH] Huge commit impro...
<vulnerable_code>#if defined(EP_ENDOM) static void ep4_mul_glv_imp(ep4_t r, const ep4_t p, const bn_t k) { int sign, i, j, l, _l[8]; bn_t n, _k[8], u, v; int8_t naf[8][RLC_FP_BITS + 1]; ep4_t q[8]; bn_null(n); bn_null(u); #endif /* EP_ENDOM */ static void ep4_mul_naf_imp(ep4_t r, const ep4_t p, const bn_t k) {...
<vulnerable_code> * @param[in] p - the point to multiply. */ static void ep4_mul_pre_ordin(ep4_t *t, const ep4_t p) { int i; ep4_dbl(t[0], p); #if defined(EP_MIXED) ep4_norm(t[0], t[0]); #if EP_DEPTH > 2 ep4_add(t[1], t[0], p); for (i = 2; i < (1 << (EP_DEPTH - 2)); i++) { ep4_add(t[i], t[i - 1], t[0]); ...
<vulnerable_code> */ static void ep4_mul_sim_plain(ep4_t r, const ep4_t p, const bn_t k, const ep4_t q, const bn_t m, ep4_t *t) { int i, l, l0, l1, n0, n1, w, gen; int8_t naf0[2 * RLC_FP_BITS + 1], naf1[2 * RLC_FP_BITS + 1], *_k, *_m; ep4_t t0[1 << (EP_WIDTH - 2)]; ep4_t t1[1 << (EP_WIDTH - 2)]; RLC_TRY { gen...
<vulnerable_code> return size; } void ep4_read_bin(ep4_t a, const uint8_t *bin, int len) { if (len == 1) { if (bin[0] == 0) { ep4_set_infty(a); } } void ep4_write_bin(uint8_t *bin, int len, const ep4_t a, int pack) { ep4_t t; ep4_null(t);<commit_title>[PATCH] Huge commit improving the API to use size_t inst...
<vulnerable_code>#if FB_EXP == BASIC || !defined(STRIP) void fb_exp_basic(fb_t c, const fb_t a, const bn_t b) { int i, l; fb_t r; if (bn_is_zero(b)) { fb_copy(r, a); for (i = l - 2; i >= 0; i--) { fb_sqr(r, r); if (bn_get_bit(b, i)) { fb_mul(r, r, a); void fb_exp_slide(fb_t c, const fb_t a, const ...
<vulnerable_code> * @param[in] radix - the radix to check. * @return if radix is a valid radix. */ static int valid_radix(int radix) { while (radix > 0) { if (radix != 1 && radix % 2 == 1) return 0; * @param[in] radix - the valid radix. * @return the logarithm of the radix in basis two. */ static int l...
<vulnerable_code>#if FP_EXP == BASIC || !defined(STRIP) void fp_exp_basic(fp_t c, const fp_t a, const bn_t b) { int i, l; fp_t r; fp_null(r); fp_copy(r, a); for (i = l - 2; i >= 0; i--) { fp_sqr(r, r); if (bn_get_bit(b, i)) { fp_mul(r, r, a); void fp_exp_slide(fp_t c, const fp_t a, const bn_t b) {...
<vulnerable_code>void fp_prime_set_pairf(const bn_t x, int pairf) { bn_t p, t0, t1; ctx_t *ctx = core_get(); int len = bn_bits(x) + 1; int8_t s[RLC_FP_BITS + 1]; bn_null(p); } } void fp_prime_set_pmers(const int *f, int len) { bn_t p, t; bn_null(p);<commit_title>[PATCH] Huge commit improving the API to use s...
<vulnerable_code> return 0; } int fp_get_bit(const fp_t a, int bit) { int d; RLC_RIP(bit, d, bit); return (a[d] >> bit) & 1; } void fp_set_bit(fp_t a, int bit, int value) { int d; dig_t mask; } } int fp_bits(const fp_t a) { int i = RLC_FP_DIGS - 1; while (i >= 0 && a[i] == 0) { } } int fp_size_str(const...
<vulnerable_code> void fp2_exp_cyc(fp2_t c, const fp2_t a, const bn_t b) { fp2_t r, s, t[1 << (FP_WIDTH - 2)]; int i, l; int8_t naf[RLC_FP_BITS + 1], *k; if (bn_is_zero(b)) { return fp2_set_dig(c, 1); RLC_TRY { fp2_new(r); fp2_new(s); for (i = 0; i < (1 << (FP_WIDTH - 2)); i ++) { fp2_null(t[i]); fp...
<vulnerable_code> bn_t _b; fp12_t t, v; int8_t u, naf[RLC_DIG + 1]; int l; if (b == 0) { fp12_set_dig(c, 1); bn_t _b; fp24_t t, v; int8_t u, naf[RLC_DIG + 1]; int l; if (b == 0) { fp24_set_dig(c, 1); bn_t _b; fp48_t t, v; int8_t u, naf[RLC_DIG + 1]; int l; if (b == 0) { fp48_set_dig(c, 1); bn_t ...
<vulnerable_code> } } void fp2_read_bin(fp2_t a, const uint8_t *bin, int len) { if (len != RLC_FP_BYTES + 1 && len != 2 * RLC_FP_BYTES) { RLC_THROW(ERR_NO_BUFFER); return; } } void fp2_write_bin(uint8_t *bin, int len, const fp2_t a, int pack) { fp2_t t; fp2_null(t); return 3 * RLC_FP_BYTES; } void fp3_read...
<vulnerable_code> #if MD_MAP == B2S160 || !defined(STRIP) void md_map_b2s160(uint8_t *hash, const uint8_t *msg, int len) { memset(hash, 0, RLC_MD_LEN_B2S160); blake2s(hash, RLC_MD_LEN_B2S160, msg, len, NULL, 0); } #if MD_MAP == B2S256 || !defined(STRIP) void md_map_b2s256(uint8_t *hash, const uint8_t *msg, int len...
<vulnerable_code>/* Public definitions */ /*============================================================================*/ void md_hmac(uint8_t *mac, const uint8_t *in, int in_len, const uint8_t *key, int key_len) { #if MD_MAP == SH224 || MD_MAP == SH256 || M...
<vulnerable_code>/* Public definitions */ /*============================================================================*/ void md_kdf(uint8_t *key, int key_len, const uint8_t *in, int in_len) { uint32_t i, j, d; uint8_t* buffer = RLC_ALLOCA(uint8_t, in_len +...
<vulnerable_code>/* Public definitions */ /*============================================================================*/ void md_mgf(uint8_t *key, int key_len, const uint8_t *in, int in_len) { uint32_t i, j, d; uint8_t *buffer = RLC_ALLOCA(uint8_t, in_len +...
<vulnerable_code> #if MD_MAP == SH224 || !defined(STRIP) void md_map_sh224(uint8_t *hash, const uint8_t *msg, int len) { SHA224Context ctx; if (SHA224Reset(&ctx) != shaSuccess) {<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> #if MD_MAP == SH224 || ...
<vulnerable_code> #if MD_MAP == SH256 || !defined(STRIP) void md_map_sh256(uint8_t *hash, const uint8_t *msg, int len) { SHA256Context ctx; if (SHA256Reset(&ctx) != shaSuccess) {<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> #if MD_MAP == SH256 || ...
<vulnerable_code> #if MD_MAP == SH384 || !defined(STRIP) void md_map_sh384(uint8_t *hash, const uint8_t *msg, int len) { SHA384Context ctx; if (SHA384Reset(&ctx) != shaSuccess) {<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> #if MD_MAP == SH384 || ...
<vulnerable_code> #if MD_MAP == SH512 || !defined(STRIP) void md_map_sh512(uint8_t *hash, const uint8_t *msg, int len) { SHA512Context ctx; if (SHA512Reset(&ctx) != shaSuccess) {<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> #if MD_MAP == SH512 || ...
<vulnerable_code> fp12_t l; ep_t *_p = RLC_ALLOCA(ep_t, m); ep2_t *_q = RLC_ALLOCA(ep2_t, m); int i, j, len = bn_bits(a) + 1; int8_t s[RLC_FP_BITS + 1]; if (m == 0) {<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> fp12_t l; ep_t *_p = RLC_ALLOCA(...
<vulnerable_code> fp24_t l; ep_t *_p = RLC_ALLOCA(ep_t, m); ep4_t *_q = RLC_ALLOCA(ep4_t, m); int i, j, len = bn_bits(a) + 1; int8_t s[RLC_FP_BITS + 1]; if (m == 0) {<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> fp24_t l; ep_t *_p = RLC_ALLOCA(...
<vulnerable_code> fp48_t l; ep_t _p; fp8_t rx, ry, rz, qn; int i, len = bn_bits(a) + 1; int8_t s[RLC_FP_BITS + 1]; fp48_null(l);<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> fp48_t l; ep_t _p; fp8_t rx, ry, rz, qn; size_t len = bn_bits(a) + 1...
<vulnerable_code> fp54_t l; ep_t _p; fp9_t rx, ry, rz, sx, sy, sz, qn; int i, len = bn_bits(a) + 1; int8_t s[RLC_FP_BITS + 1]; fp54_null(l);<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> fp54_t l; ep_t _p; fp9_t rx, ry, rz, sx, sy, sz, qn; siz...
<vulnerable_code>#endif } int rand_check(uint8_t *buf, int size) { int count = 0; for (int i = 1; i < size; i++) {<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> #endif } int rand_check(uint8_t *buf, size_t size) { int count = 0; for (int i = 1; ...
<vulnerable_code> * param[in] in - the input string. * param[in] in_len - the number of bytes in the input. */ static void rand_hash(uint8_t *out, int out_len, uint8_t *in, int in_len) { uint32_t j = util_conv_big(8 * out_len); int len = RLC_CEIL(out_len, RLC_MD_LEN); uint8_t* buf = RLC_ALLOCA(uint8_t,...
<vulnerable_code>#endif } int util_bits_dig(dig_t a) { return RLC_DIG - arch_lzcnt(a); } <commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> #endif } size_t util_bits_dig(dig_t a) { return RLC_DIG - arch_lzcnt(a); }
<vulnerable_code> } TEST_END; TEST_CASE("reading and writing a positive number are consistent") { int len = RLC_CEIL(RLC_BN_BITS, 8); bn_rand(a, RLC_POS, RLC_BN_BITS); for (int j = 2; j <= 64; j++) { bits = bn_size_str(a, j); TEST_END; TEST_CASE("reading and writing a negative number are consisten...
<vulnerable_code> } TEST_ASSERT(code == RLC_OK, end); core_init(); #pragma omp parallel copyin(core_ctx) shared(code) {<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> } TEST_ASSERT(code == RLC_OK, end); core_clean(); core_init(); #pragma...
<vulnerable_code>} int util(void) { int l, code = RLC_ERR; gt_t a, b, c; uint8_t bin[24 * RLC_PC_BYTES]; <commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> } int util(void) { int code = RLC_ERR; gt_t a, b, c; uint8_t bin[24 * RLC_PC_BYTES];
<vulnerable_code> static int test(void) { uint8_t out[64]; int len = sizeof(out) / 2, code = RLC_ERR; TEST_ONCE("rdrand hardware generator is non-trivial") { memset(out, 0, 2 * len);<commit_title>[PATCH] Huge commit improving the API to use size_t instead of int.<commit_description><fixed_code> static int test(v...
<vulnerable_code> API.userCount().then((count) => { let url; if (count > 0) { const redirectPath = window.location.pathname + window.location.search; url = `/login/?url=${encodeURIComponent(redirectPath)}`; } else { url = '/signup/'; } if (window.location.pathname !== url.split('...
<vulnerable_code> API.login(emailValue, passwordValue). then(() => { const search = window.location.search; const match = search.match(/url=([^=&]+)/); let url = '/'; if (match) { url = decodeURIComponent(match[1]); } window.location.href = url; ...
<vulnerable_code> components_config = config["components"] theme = config.get("theme", "default") original_mapping: dict[int, Block] = {} root_urls = set() def get_block_instance(id: int) -> Block: for block_config in components_config:<commit_title>[PATCH] Update gra...
<vulnerable_code> warnx("Unable to get MAC address: %s", sendpacket_geterr(sp)); err(-1, "Please consult the man page for using the -M option."); } sendpacket_close(sp); memcpy(options.intf1_mac, eth_buff, ETHER_ADDR_LEN); } if (memcmp(options.intf2_mac, "\00\00\0...
<vulnerable_code> dget(dentry); } mntget(path->mnt); cookie = dentry->d_inode->i_op->follow_link(dentry, nd); error = PTR_ERR(cookie); if (!IS_ERR(cookie)) {<commit_title>[PATCH] fix autofs/afs/etc. magic mountpoint breakage<commit_description>We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT) ...
<vulnerable_code> goto out; error = PROC_I(inode)->op.proc_get_link(inode, &nd->path); nd->last_type = LAST_BIND; out: return ERR_PTR(error); }<commit_title>[PATCH] fix autofs/afs/etc. magic mountpoint breakage<commit_description>We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT) if /mnt/tmp is ...
<vulnerable_code> { FTerminal->LogEvent(FORMAT(L"Warning: Remote host set a compound pathname '%s'", (Line))); } FullFileName = SourceDir + OnlyFileName; OperationProgress->SetFile(FullFileName);<commit_title>[PATCH] Bug 1675: Prevent SCP server sending files that wer...
<vulnerable_code> FILE *file; size_t nread; char *full_content = NULL; size_t total_lenght = 0; msre_var *rvar = NULL; continue; } while ((nread = fread(buf, 1, 1023, file)) > 0) ...
<vulnerable_code> bool JavascriptArray::IsMissingItem(uint32 index) { bool isIntArray = false, isFloatArray = false; this->GetArrayTypeAndConvert(&isIntArray, &isFloatArray); // Prototype lookup for missing elements if (!pArr->HasNoMissingValues()) { for (uin...
<vulnerable_code> assert.areEqual(101, arr.length); } }, ]; testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });<commit_title>[PATCH] [CVE-2017-0196] Fixing an heap overread during slice.<commit_description>The MissingItem check is happening on the array in a loop. It is po...
<vulnerable_code> length++; for (j=0; j < (ssize_t) length; j++) { switch (depth) { case 1: break; } } CheckNumberCompactPixels; compact_pixels++; } }<commit_title>[PATCH] Moved check for<commit_description><fixed_code> length++; for (j=0;...
<vulnerable_code> res = document.URL; } } return kWidget.sanitize(decodeURIComponent(res)); } // -------------- finish setup player url according to the socialShareURL flashvar ------- // <commit_title>[PATCH] encoding back the sanitized string<commit_description><fixed_code> res = document.URL; ...
<vulnerable_code># Based on local.py (c) 2012, Michael DeHaan <michael.dehaan@gmail.com> # (c) 2013, Maykel Moya <mmoya@speedyrails.com> # # This file is part of Ansible # import distutils.spawn import traceback import os import shutil import subprocess from ansible import errors from ansible import utils from ansible....