code stringlengths 14 2.05k | label int64 0 1 | programming_language stringclasses 7
values | cwe_id stringlengths 6 14 | cwe_name stringlengths 5 98 ⌀ | description stringlengths 36 379 ⌀ | url stringlengths 36 48 ⌀ | label_name stringclasses 2
values |
|---|---|---|---|---|---|---|---|
size_t fp_size_str(const fp_t a, unsigned int radix) {
bn_t t;
size_t digits = 0;
bn_null(t);
RLC_TRY {
bn_new(t);
fp_prime_back(t, a);
digits = bn_size_str(t, radix);
} RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
RLC_FINALLY {
bn_free(t);
}
return digits;
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp_read_str(fp_t a, const char *str, size_t len, unsigned int radix) {
bn_t t;
bn_null(t);
RLC_TRY {
bn_new(t);
bn_read_str(t, str, len, radix);
if (bn_is_zero(t)) {
fp_zero(a);
} else {
if (t->used == 1) {
fp_prime_conv_dig(a, t->dp[0]);
if (bn_sign(t) == RLC_NEG) {
fp_neg(a, a);
... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp_set_bit(fp_t a, size_t bit, int value) {
int d;
dig_t mask;
RLC_RIP(bit, d, bit);
mask = (dig_t)1 << bit;
if (value == 1) {
a[d] |= mask;
} else {
a[d] &= ~mask;
}
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
int fp_get_bit(const fp_t a, size_t bit) {
int d;
RLC_RIP(bit, d, bit);
return (a[d] >> bit) & 1;
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
size_t fp_bits(const fp_t a) {
int i = RLC_FP_DIGS - 1;
while (i >= 0 && a[i] == 0) {
i--;
}
if (i > 0) {
return (i << RLC_DIG_LOG) + util_bits_dig(a[i]);
} else {
return util_bits_dig(a[0]);
}
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp_write_bin(uint8_t *bin, size_t len, const fp_t a) {
bn_t t;
bn_null(t);
if (len != RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
RLC_TRY {
bn_new(t);
fp_prime_back(t, a);
bn_write_bin(bin, len, t);
} RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
RLC_FINALLY {
bn_free(t);
}
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp48_exp_cyc_sps(fp48_t c, const fp48_t a, const int *b, size_t len,
int sign) {
size_t i, j, k, w = len;
fp48_t t, *u = RLC_ALLOCA(fp48_t, w);
if (len == 0) {
RLC_FREE(u);
fp48_set_dig(c, 1);
return;
}
fp48_null(t);
RLC_TRY {
if (u == NULL) {
RLC_THROW(ERR_NO_MEMORY);
}
for (i = 0; i ... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp8_exp_cyc(fp8_t c, const fp8_t a, const bn_t b) {
fp8_t r, s, t[1 << (FP_WIDTH - 2)];
int8_t naf[RLC_FP_BITS + 1], *k;
size_t l;
if (bn_is_zero(b)) {
return fp8_set_dig(c, 1);
}
fp8_null(r);
fp8_null(s);
RLC_TRY {
fp8_new(r);
fp8_new(s);
for (int i = 0; i < (1 << (FP_WIDTH - 2)); i ++) {
fp... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp2_exp_cyc(fp2_t c, const fp2_t a, const bn_t b) {
fp2_t r, s, t[1 << (FP_WIDTH - 2)];
int8_t naf[RLC_FP_BITS + 1], *k;
size_t l;
if (bn_is_zero(b)) {
return fp2_set_dig(c, 1);
}
fp2_null(r);
fp2_null(s);
RLC_TRY {
fp2_new(r);
fp2_new(s);
for (int i = 0; i < (1 << (FP_WIDTH - 2)); i ++) {
fp... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp12_exp_cyc_sps(fp12_t c, const fp12_t a, const int *b, size_t len,
int sign) {
size_t i, j, k, w = len;
fp12_t t, *u = RLC_ALLOCA(fp12_t, w);
if (len == 0) {
RLC_FREE(u);
fp12_set_dig(c, 1);
return;
}
fp12_null(t);
RLC_TRY {
if (u == NULL) {
RLC_THROW(ERR_NO_MEMORY);
}
for (i = 0; i ... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp24_exp_cyc_sim(fp24_t e, const fp24_t a, const bn_t b, const fp24_t c, const bn_t d) {
int n0, n1;
int8_t naf0[RLC_FP_BITS + 1], naf1[RLC_FP_BITS + 1], *_k, *_m;
fp24_t r, t0[1 << (EP_WIDTH - 2)];
fp24_t s, t1[1 << (EP_WIDTH - 2)];
size_t l, l0, l1;
if (bn_is_zero(b)) {
return fp24_exp_cyc(e, c, d);
}
... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp24_exp_cyc_sps(fp24_t c, const fp24_t a, const int *b, size_t len,
int sign) {
size_t i, j, k, w = len;
fp24_t t, *u = RLC_ALLOCA(fp24_t, w);
if (len == 0) {
RLC_FREE(u);
fp24_set_dig(c, 1);
return;
}
fp24_null(t);
RLC_TRY {
if (u == NULL) {
RLC_THROW(ERR_NO_MEMORY);
}
for (i = 0; i ... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp2_exp_cyc_sim(fp2_t e, const fp2_t a, const bn_t b, const fp2_t c, const bn_t d) {
int n0, n1;
int8_t naf0[RLC_FP_BITS + 1], naf1[RLC_FP_BITS + 1], *_k, *_m;
fp2_t r, t0[1 << (EP_WIDTH - 2)];
fp2_t s, t1[1 << (EP_WIDTH - 2)];
size_t l, l0, l1;
if (bn_is_zero(b)) {
return fp2_exp_cyc(e, c, d);
}
if (b... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp54_exp_cyc_sps(fp54_t c, const fp54_t a, const int *b, size_t len,
int sign) {
size_t i, j, k, w = len;
fp54_t t, *u = RLC_ALLOCA(fp54_t, w);
if (len == 0) {
RLC_FREE(u);
fp54_set_dig(c, 1);
return;
}
fp54_null(t);
RLC_TRY {
if (u == NULL) {
RLC_THROW(ERR_NO_MEMORY);
}
for (i = 0; i ... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp12_exp_dig(fp12_t c, const fp12_t a, dig_t b) {
bn_t _b;
fp12_t t, v;
int8_t u, naf[RLC_DIG + 1];
size_t l;
if (b == 0) {
fp12_set_dig(c, 1);
return;
}
bn_null(_b);
fp12_null(t);
fp12_null(v);
RLC_TRY {
bn_new(_b);
fp12_new(t);
fp12_new(v);
fp12_copy(t, a);
if (fp12_test_cyc(a)) {
... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp24_exp_dig(fp24_t c, const fp24_t a, dig_t b) {
bn_t _b;
fp24_t t, v;
int8_t u, naf[RLC_DIG + 1];
size_t l;
if (b == 0) {
fp24_set_dig(c, 1);
return;
}
bn_null(_b);
fp24_null(t);
fp24_null(v);
RLC_TRY {
bn_new(_b);
fp24_new(t);
fp24_new(v);
fp24_copy(t, a);
if (fp24_test_cyc(a)) {
... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp48_exp_dig(fp48_t c, const fp48_t a, dig_t b) {
bn_t _b;
fp48_t t, v;
int8_t u, naf[RLC_DIG + 1];
size_t l;
if (b == 0) {
fp48_set_dig(c, 1);
return;
}
bn_null(_b);
fp48_null(t);
fp48_null(v);
RLC_TRY {
bn_new(_b);
fp48_new(t);
fp48_new(v);
fp48_copy(t, a);
if (fp48_test_cyc(a)) {
... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp54_exp_dig(fp54_t c, const fp54_t a, dig_t b) {
bn_t _b;
fp54_t t, v;
int8_t u, naf[RLC_DIG + 1];
size_t l;
if (b == 0) {
fp54_set_dig(c, 1);
return;
}
bn_null(_b);
fp54_null(t);
fp54_null(v);
RLC_TRY {
bn_new(_b);
fp54_new(t);
fp54_new(v);
fp54_copy(t, a);
if (fp54_test_cyc(a)) {
... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp6_read_bin(fp6_t a, const uint8_t *bin, size_t len) {
if (len != 6 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp2_read_bin(a[0], bin, 2 * RLC_FP_BYTES);
fp2_read_bin(a[1], bin + 2 * RLC_FP_BYTES, 2 * RLC_FP_BYTES);
fp2_read_bin(a[2], bin + 4 * RLC_FP_BYTES, 2 * RLC_FP_BYTES);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp2_write_bin(uint8_t *bin, size_t len, const fp2_t a, int pack) {
fp2_t t;
fp2_null(t);
RLC_TRY {
fp2_new(t);
if (pack && fp2_test_cyc(a)) {
if (len < RLC_FP_BYTES + 1) {
RLC_THROW(ERR_NO_BUFFER);
return;
} else {
fp2_pck(t, a);
fp_write_bin(bin, RLC_FP_BYTES, t[0]);
bin[RLC_FP... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp4_read_bin(fp4_t a, const uint8_t *bin, size_t len) {
if (len != 4 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp2_read_bin(a[0], bin, 2 * RLC_FP_BYTES);
fp2_read_bin(a[1], bin + 2 * RLC_FP_BYTES, 2 * RLC_FP_BYTES);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp3_write_bin(uint8_t *bin, size_t len, const fp3_t a) {
if (len != 3 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp_write_bin(bin, RLC_FP_BYTES, a[0]);
fp_write_bin(bin + RLC_FP_BYTES, RLC_FP_BYTES, a[1]);
fp_write_bin(bin + 2 * RLC_FP_BYTES, RLC_FP_BYTES, a[2]);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp8_read_bin(fp8_t a, const uint8_t *bin, size_t len) {
if (len != 8 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp4_read_bin(a[0], bin, 4 * RLC_FP_BYTES);
fp4_read_bin(a[1], bin + 4 * RLC_FP_BYTES, 4 * RLC_FP_BYTES);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp24_write_bin(uint8_t *bin, size_t len, const fp24_t a, int pack) {
fp24_t t;
fp24_null(t);
RLC_TRY {
fp24_new(t);
if (pack) {
if (len != 16 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
}
fp24_pck(t, a);
fp4_write_bin(bin, 4 * RLC_FP_BYTES, a[1][0]);
fp4_write_bin(bin + 4 * RLC_FP_BYTE... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp48_read_bin(fp48_t a, const uint8_t *bin, size_t len) {
if (len != 32 * RLC_FP_BYTES && len != 48 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
if (len == 32 * RLC_FP_BYTES) {
fp8_zero(a[0][0]);
fp8_read_bin(a[0][1], bin, 8 * RLC_FP_BYTES);
fp8_read_bin(a[0][2], bin + 8 * RLC_FP_BYTES, 8 * R... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp4_write_bin(uint8_t *bin, size_t len, const fp4_t a) {
if (len != 4 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp2_write_bin(bin, 2 * RLC_FP_BYTES, a[0], 0);
fp2_write_bin(bin + 2 * RLC_FP_BYTES, 2 * RLC_FP_BYTES, a[1], 0);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp6_write_bin(uint8_t *bin, size_t len, const fp6_t a) {
if (len != 6 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp2_write_bin(bin, 2 * RLC_FP_BYTES, a[0], 0);
fp2_write_bin(bin + 2 * RLC_FP_BYTES, 2 * RLC_FP_BYTES, a[1], 0);
fp2_write_bin(bin + 4 * RLC_FP_BYTES, 2 * RLC_FP_BYTES, a[2], 0);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp24_read_bin(fp24_t a, const uint8_t *bin, size_t len) {
if (len != 16 * RLC_FP_BYTES && len != 24 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
if (len == 16 * RLC_FP_BYTES) {
fp4_zero(a[0][0]);
fp4_zero(a[0][1]);
fp4_read_bin(a[1][0], bin, 4 * RLC_FP_BYTES);
fp4_read_bin(a[1][1], bin + 4 ... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp2_read_bin(fp2_t a, const uint8_t *bin, size_t len) {
if (len != RLC_FP_BYTES + 1 && len != 2 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
if (len == RLC_FP_BYTES + 1) {
fp_read_bin(a[0], bin, RLC_FP_BYTES);
fp_zero(a[1]);
fp_set_bit(a[1], 0, bin[RLC_FP_BYTES]);
fp2_upk(a, a);
}
if (len... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp54_write_bin(uint8_t *bin, size_t len, const fp54_t a, int pack) {
fp54_t t;
fp54_null(t);
RLC_TRY {
fp54_new(t);
if (pack) {
if (len != 36 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
}
fp54_pck(t, a);
fp9_write_bin(bin, 9 * RLC_FP_BYTES, a[1][0]);
fp9_write_bin(bin + 9 * RLC_FP_BYTE... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp54_read_bin(fp54_t a, const uint8_t *bin, size_t len) {
if (len != 36 * RLC_FP_BYTES && len != 54 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
if (len == 36 * RLC_FP_BYTES) {
fp9_zero(a[0][0]);
fp9_zero(a[0][1]);
fp9_read_bin(a[1][0], bin, 9 * RLC_FP_BYTES);
fp9_read_bin(a[1][1], bin + 9 ... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp3_read_bin(fp3_t a, const uint8_t *bin, size_t len) {
if (len != 3 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp_read_bin(a[0], bin, RLC_FP_BYTES);
fp_read_bin(a[1], bin + RLC_FP_BYTES, RLC_FP_BYTES);
fp_read_bin(a[2], bin + 2 * RLC_FP_BYTES, RLC_FP_BYTES);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp8_write_bin(uint8_t *bin, size_t len, const fp8_t a) {
if (len != 8 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp4_write_bin(bin, 4 * RLC_FP_BYTES, a[0]);
fp4_write_bin(bin + 4 * RLC_FP_BYTES, 4 * RLC_FP_BYTES, a[1]);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp9_read_bin(fp9_t a, const uint8_t *bin, size_t len) {
if (len != 9 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp3_read_bin(a[0], bin, 3 * RLC_FP_BYTES);
fp3_read_bin(a[1], bin + 3 * RLC_FP_BYTES, 3 * RLC_FP_BYTES);
fp3_read_bin(a[2], bin + 6 * RLC_FP_BYTES, 3 * RLC_FP_BYTES);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp12_read_bin(fp12_t a, const uint8_t *bin, size_t len) {
if (len != 8 * RLC_FP_BYTES && len != 12 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
if (len == 8 * RLC_FP_BYTES) {
fp2_zero(a[0][0]);
fp2_read_bin(a[0][1], bin, 2 * RLC_FP_BYTES);
fp2_read_bin(a[0][2], bin + 2 * RLC_FP_BYTES, 2 * RLC... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp12_write_bin(uint8_t *bin, size_t len, const fp12_t a, int pack) {
fp12_t t;
fp12_null(t);
RLC_TRY {
fp12_new(t);
if (pack) {
if (len != 8 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
}
fp12_pck(t, a);
fp2_write_bin(bin, 2 * RLC_FP_BYTES, a[0][1], 0);
fp2_write_bin(bin + 2 * RLC_FP_BY... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp9_write_bin(uint8_t *bin, size_t len, const fp9_t a) {
if (len != 9 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp3_write_bin(bin, 3 * RLC_FP_BYTES, a[0]);
fp3_write_bin(bin + 3 * RLC_FP_BYTES, 3 * RLC_FP_BYTES, a[1]);
fp3_write_bin(bin + 6 * RLC_FP_BYTES, 3 * RLC_FP_BYTES, a[2]);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp48_write_bin(uint8_t *bin, size_t len, const fp48_t a, int pack) {
fp48_t t;
fp48_null(t);
RLC_TRY {
fp48_new(t);
if (pack) {
if (len != 32 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
}
fp48_pck(t, a);
fp8_write_bin(bin, 8 * RLC_FP_BYTES, a[0][1]);
fp8_write_bin(bin + 8 * RLC_FP_BYTE... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp18_read_bin(fp18_t a, const uint8_t *bin, size_t len) {
if (len != 18 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp9_read_bin(a[0], bin, 9 * RLC_FP_BYTES);
fp9_read_bin(a[1], bin + 9 * RLC_FP_BYTES, 9 * RLC_FP_BYTES);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void fp18_write_bin(uint8_t *bin, size_t len, const fp18_t a) {
if (len != 18 * RLC_FP_BYTES) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
fp9_write_bin(bin, 9 * RLC_FP_BYTES, a[0]);
fp9_write_bin(bin + 9 * RLC_FP_BYTES, 9 * RLC_FP_BYTES, a[1]);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_map_b2s256(uint8_t *hash, const uint8_t *msg, size_t len) {
memset(hash, 0, RLC_MD_LEN_B2S256);
blake2s(hash, RLC_MD_LEN_B2S256, msg, len, NULL, 0);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_map_b2s160(uint8_t *hash, const uint8_t *msg, size_t len) {
memset(hash, 0, RLC_MD_LEN_B2S160);
blake2s(hash, RLC_MD_LEN_B2S160, msg, len, NULL, 0);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_hmac(uint8_t *mac, const uint8_t *in, size_t in_len, const uint8_t *key,
size_t key_len) {
#if MD_MAP == SH224 || MD_MAP == SH256 || MD_MAP == B2S160 || MD_MAP == B2S256
#define block_size 64
#elif MD_MAP == SH384 || MD_MAP == SH512
#define block_size 128
#endif
uint8_t opad[block_size + RLC_MD_LEN... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_kdf(uint8_t *key, size_t key_len, const uint8_t *in, size_t in_len) {
uint32_t i, j, d;
uint8_t* buffer = RLC_ALLOCA(uint8_t, in_len + sizeof(uint32_t));
uint8_t* t = RLC_ALLOCA(uint8_t, key_len + RLC_MD_LEN);
if (buffer == NULL || t == NULL) {
RLC_FREE(buffer);
RLC_FREE(t);
RLC_THROW(ERR_NO_MEMORY);
... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_mgf(uint8_t *key, size_t key_len, const uint8_t *in, size_t in_len) {
uint32_t i, j, d;
uint8_t *buffer = RLC_ALLOCA(uint8_t, in_len + sizeof(uint32_t));
uint8_t *t = RLC_ALLOCA(uint8_t, key_len + RLC_MD_LEN);
if (buffer == NULL || t == NULL) {
RLC_FREE(buffer);
RLC_FREE(t);
RLC_THROW(ERR_NO_MEMORY);... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_map_sh224(uint8_t *hash, const uint8_t *msg, size_t len) {
SHA224Context ctx;
if (SHA224Reset(&ctx) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA224Input(&ctx, msg, len) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA224Result(&ctx, hash) != shaSuccess) {
RLC_THROW(ERR... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_map_sh256(uint8_t *hash, const uint8_t *msg, size_t len) {
SHA256Context ctx;
if (SHA256Reset(&ctx) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA256Input(&ctx, msg, len) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA256Result(&ctx, hash) != shaSuccess) {
RLC_THROW(ERR... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_map_sh384(uint8_t *hash, const uint8_t *msg, size_t len) {
SHA384Context ctx;
if (SHA384Reset(&ctx) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA384Input(&ctx, msg, len) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA384Result(&ctx, hash) != shaSuccess) {
RLC_THROW(ERR... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void md_map_sh512(uint8_t *hash, const uint8_t *msg, size_t len) {
SHA512Context ctx;
if (SHA512Reset(&ctx) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA512Input(&ctx, msg, len) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA512Result(&ctx, hash) != shaSuccess) {
RLC_THROW(ERR... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static void pp_mil_k12(fp12_t r, ep2_t *t, ep2_t *q, ep_t *p, int m, bn_t a) {
fp12_t l;
ep_t *_p = RLC_ALLOCA(ep_t, m);
ep2_t *_q = RLC_ALLOCA(ep2_t, m);
size_t len = bn_bits(a) + 1;
int i, j;
int8_t s[RLC_FP_BITS + 1];
if (m == 0) {
return;
}
fp12_null(l);
RLC_TRY {
fp12_new(l);
if (_p == NULL || _... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static void pp_mil_k24(fp24_t r, ep4_t *t, ep4_t *q, ep_t *p, int m, bn_t a) {
fp24_t l;
ep_t *_p = RLC_ALLOCA(ep_t, m);
ep4_t *_q = RLC_ALLOCA(ep4_t, m);
size_t len = bn_bits(a) + 1;
int i, j;
int8_t s[RLC_FP_BITS + 1];
if (m == 0) {
return;
}
fp24_null(l);
RLC_TRY {
fp24_new(l);
if (_p == NULL || _... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static void pp_mil_k48(fp48_t r, const fp8_t qx, const fp8_t qy, const ep_t p,
const bn_t a) {
fp48_t l;
ep_t _p;
fp8_t rx, ry, rz, qn;
size_t len = bn_bits(a) + 1;
int i;
int8_t s[RLC_FP_BITS + 1];
fp48_null(l);
ep_null(_p);
fp8_null(rx);
fp8_null(ry);
fp8_null(rz);
fp8_null(qn);
RLC_TRY {
fp48_new(... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static void pp_mil_k8(fp8_t r, ep2_t *t, ep2_t *q, ep_t *p, int m, bn_t a) {
fp8_t l;
ep_t *_p = RLC_ALLOCA(ep_t, m);
ep2_t *_q = RLC_ALLOCA(ep2_t, m);
size_t len = bn_bits(a) + 1;
int i, j;
int8_t s[RLC_FP_BITS + 1];
if (m == 0) {
return;
}
fp8_null(l);
RLC_TRY {
fp8_new(l);
if (_p == NULL || _q == ... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
int rand_check(uint8_t *buf, size_t size) {
int count = 0;
for (int i = 1; i < size; i++) {
if (buf[i] == buf[i - 1]) {
count++;
} else {
count = 0;
}
}
if (count > RAND_REP) {
return RLC_ERR;
}
return RLC_OK;
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static int rand_add(uint8_t *state, uint8_t *hash, size_t size) {
int carry = 0;
for (int i = size - 1; i >= 0; i--) {
/* Make sure carries are detected. */
int16_t s;
s = (state[i] + hash[i] + carry);
state[i] = s & 0xFF;
carry = s >> 8;
}
return carry;
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void rand_bytes(uint8_t *buf, size_t size) {
uint8_t hash[RLC_MD_LEN];
int carry, len = (RLC_RAND_SIZE - 1)/2;
ctx_t *ctx = core_get();
if (sizeof(int) > 2 && size > (1 << 16)) {
RLC_THROW(ERR_NO_VALID);
return;
}
/* buf = hash_gen(size) */
rand_gen(buf, size);
/* H = hash(03 || V) */
ctx->rand[0] = 0x3... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
void rand_seed(uint8_t *buf, size_t size) {
ctx_t *ctx = core_get();
size_t len = (RLC_RAND_SIZE - 1) / 2;
if (size <= 0) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (sizeof(int) > 4 && size > (1 << 32)) {
RLC_THROW(ERR_NO_VALID);
return;
}
ctx->rand[0] = 0x0;
if (ctx->seeded == 0) {
/* V = hash_df(see... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static void rand_gen(uint8_t *out, size_t out_len) {
int m = RLC_CEIL(out_len, RLC_MD_LEN);
uint8_t hash[RLC_MD_LEN], data[(RLC_RAND_SIZE - 1)/2];
ctx_t *ctx = core_get();
/* data = V */
memcpy(data, ctx->rand + 1, (RLC_RAND_SIZE - 1)/2);
for (int i = 0; i < m; i++) {
/* w_i = Hash(data) */
md_map(hash, data... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static int rand_inc(uint8_t *data, size_t size, int digit) {
int carry = digit;
for (int i = size - 1; i >= 0; i--) {
int16_t s;
s = (data[i] + carry);
data[i] = s & 0xFF;
carry = s >> 8;
}
return carry;
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static void rand_hash(uint8_t *out, size_t out_len, uint8_t *in,
size_t in_len) {
uint32_t j = util_conv_big(8 * out_len);
size_t len = RLC_CEIL(out_len, RLC_MD_LEN);
uint8_t* buf = RLC_ALLOCA(uint8_t, 1 + sizeof(uint32_t) + in_len);
uint8_t hash[RLC_MD_LEN];
if (buf == NULL) {
RLC_THROW(ERR_NO_MEMORY);
ret... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
size_t util_bits_dig(dig_t a) {
return RLC_DIG - arch_lzcnt(a);
} | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static int square_root(void) {
size_t bits;
bn_t a, b, c;
int code = RLC_ERR;
bn_null(a);
bn_null(b);
bn_null(c);
RLC_TRY {
bn_new(a);
bn_new(b);
bn_new(c);
TEST_ONCE("square root extraction is correct") {
for (bits = 0; bits < RLC_BN_BITS / 2; bits++) {
bn_rand(a, RLC_POS, bits);
bn_sqr(c,... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
int util(void) {
int code = RLC_ERR;
gt_t a, b, c;
uint8_t bin[24 * RLC_PC_BYTES];
gt_null(a);
gt_null(b);
gt_null(c);
RLC_TRY {
gt_new(a);
gt_new(b);
gt_new(c);
TEST_CASE("comparison is consistent") {
gt_rand(a);
gt_rand(b);
TEST_ASSERT(gt_cmp(a, b) != RLC_EQ, end);
}
TEST_END;
TEST_C... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static int test(void) {
uint8_t out[64];
size_t len = sizeof(out) / 2, code = RLC_ERR;
TEST_ONCE("rdrand hardware generator is non-trivial") {
memset(out, 0, 2 * len);
rand_bytes(out, len);
/* This fails with negligible probability. */
TEST_ASSERT(memcmp(out, out + len, len) != 0, end);
}
TEST_END;
code... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static int restrictedFile(const char *filename)
{
char *stripped_filename;
RAII_VAR(char *, path, NULL, ast_free);
RAII_VAR(char *, real_path, NULL, ast_free);
if (live_dangerously) {
return 0;
}
stripped_filename = ast_strip(ast_strdupa(filename));
/* If the file path starts with '/', don't prepend ast_con... | 1 | C | CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the... | https://cwe.mitre.org/data/definitions/22.html | safe |
Suite *cjose_jwe_suite()
{
Suite *suite = suite_create("jwe");
TCase *tc_jwe = tcase_create("core");
tcase_set_timeout(tc_jwe, 120.0);
tcase_add_test(tc_jwe, test_cjose_jwe_node_jose_encrypt_self_decrypt);
tcase_add_test(tc_jwe, test_cjose_jwe_self_encrypt_self_decrypt);
tcase_add_test(tc_jwe, ... | 1 | C | CWE-327 | Use of a Broken or Risky Cryptographic Algorithm | The product uses a broken or risky cryptographic algorithm or protocol. | https://cwe.mitre.org/data/definitions/327.html | safe |
OE_INLINE void _handle_oret(
oe_sgx_td_t* td,
uint16_t func,
uint16_t result,
uint64_t arg)
{
oe_callsite_t* callsite = td->callsites;
if (!callsite)
return;
td->oret_func = func;
td->oret_result = result;
td->oret_arg = arg;
/* Restore the FXSTATE and flags */
asm... | 1 | C | CWE-665 | Improper Initialization | The product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used. | https://cwe.mitre.org/data/definitions/665.html | safe |
void _reset_fxsave_state()
{
/* Initialize the FXSAVE state values to Linux x86-64 ABI defined values:
* FCW = 0x037F, MXCSR = 0x1FBF, MXCSR mask = 0xFFFF */
static OE_ALIGNED(OE_FXSAVE_ALIGNMENT) const uint64_t
_initial_fxstate[OE_FXSAVE_AREA_SIZE / sizeof(uint64_t)] = {
0x037F, 0, ... | 1 | C | CWE-665 | Improper Initialization | The product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used. | https://cwe.mitre.org/data/definitions/665.html | safe |
JSON_read(int fd)
{
uint32_t hsize, nsize;
size_t strsize;
char *str;
cJSON *json = NULL;
int rc;
/*
* Read a four-byte integer, which is the length of the JSON to follow.
* Then read the JSON into a buffer and parse it. Return a parsed JSON
* structure, NULL if there was an err... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
static BOOL nsc_stream_initialize(NSC_CONTEXT* context, wStream* s)
{
WINPR_ASSERT(context);
WINPR_ASSERT(context->priv);
if (!Stream_CheckAndLogRequiredLengthWLog(context->priv->log, s, 20))
return FALSE;
size_t total = 0;
for (size_t i = 0; i < 4; i++)
{
Stream_Read_UINT32(s, context->PlaneByteCount[i]);
... | 1 | C | CWE-125 | Out-of-bounds Read | The product reads data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/125.html | safe |
static BOOL nsc_rle_decompress_data(NSC_CONTEXT* context)
{
if (!context)
return FALSE;
const BYTE* rle = context->Planes;
size_t rleSize = context->PlanesSize;
WINPR_ASSERT(rle);
for (size_t i = 0; i < 4; i++)
{
const UINT32 originalSize = context->OrgByteCount[i];
const UINT32 planeSize = context->Plane... | 1 | C | CWE-125 | Out-of-bounds Read | The product reads data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/125.html | safe |
static BOOL nsc_rle_decode(const BYTE* in, size_t inSize, BYTE* out, UINT32 outSize,
UINT32 originalSize)
{
UINT32 left = originalSize;
while (left > 4)
{
if (inSize < 1)
return FALSE;
inSize--;
const BYTE value = *in++;
UINT32 len = 0;
if (left == 5)
{
if (outSize < 1... | 1 | C | CWE-125 | Out-of-bounds Read | The product reads data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/125.html | safe |
static int ncrush_generate_tables(NCRUSH_CONTEXT* context)
{
UINT32 k, i;
int j, l;
k = 0;
WINPR_ASSERT(context);
WINPR_ASSERT(28 < ARRAYSIZE(LOMBitsLUT));
for (i = 0; i < 28; i++)
{
for (j = 0; j < 1 << LOMBitsLUT[i]; j++)
{
l = (k++) + 2;
context->HuffTableLOM[l] = (int)i;
}
}
for (k = 2; k < ... | 1 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | safe |
_blackbox_vlogger(int32_t target,
struct qb_log_callsite *cs, struct timespec *timestamp, va_list ap)
{
size_t max_size;
size_t actual_size;
uint32_t fn_size;
char *chunk;
char *msg_len_pt;
uint32_t msg_len;
struct qb_log_target *t = qb_log_target_get(target);
if (t->instance == NULL) {
return;
}
fn_s... | 1 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | safe |
START_TEST(test_log_long_msg)
{
int lpc;
int rc;
int i, max = 1000;
char *buffer = calloc(1, max);
qb_log_init("test", LOG_USER, LOG_DEBUG);
rc = qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
ck_assert_int_eq(rc, 0);
rc = qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, 1024);
ck_assert_int_eq(rc, 0)... | 1 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | safe |
consume_count(type)
const char **type;
{
// Note by RizinOrg:
// to prevent the overflow check to be optimized out
// by the compiler, this variable needs to be volatile.
volatile int count = 0;
if (!isdigit((unsigned char)**type))
return -1;
while (isdigit((unsigned char)**type)) {
count *= 10;
/* Ch... | 1 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | safe |
int h1_parse_cont_len_header(struct h1m *h1m, struct ist *value)
{
char *e, *n;
long long cl;
int not_first = !!(h1m->flags & H1_MF_CLEN);
struct ist word;
word.ptr = value->ptr;
e = value->ptr + value->len;
while (1) {
if (word.ptr >= e) {
/* empty header or empty value */
goto fail;
}
/* skip le... | 1 | C | CWE-444 | Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling') | The product acts as an intermediary HTTP agent
(such as a proxy or firewall) in the data flow between two
entities such as a client and server, but it does not
interpret malformed HTTP requests or responses in ways that
are consistent with how the messages will be processed by
... | https://cwe.mitre.org/data/definitions/444.html | safe |
void client_reset(t_client *client)
{
char *hash;
char *msg;
char *cidinfo;
debug(LOG_DEBUG, "Resetting client [%s]", client->mac);
// Reset traffic counters
client->counters.incoming = 0;
client->counters.outgoing = 0;
client->counters.last_updated = time(NULL);
// Reset session time
client->session_start ... | 1 | C | CWE-401 | Missing Release of Memory after Effective Lifetime | The product does not sufficiently track and release allocated memory after it has been used, which slowly consumes remaining memory. | https://cwe.mitre.org/data/definitions/401.html | safe |
_client_list_free_node(t_client *client)
{
char *msg;
char *cidinfo;
if (client->cid) {
// Remove any existing cidfile:
if (strlen(client->cid) > 0) {
msg = safe_calloc(SMALL_BUF);
cidinfo = safe_calloc(MID_BUF);
safe_snprintf(cidinfo, MID_BUF, "cid=\"%s\"", client->cid);
write_client_info(msg, SM... | 1 | C | CWE-401 | Missing Release of Memory after Effective Lifetime | The product does not sufficiently track and release allocated memory after it has been used, which slowly consumes remaining memory. | https://cwe.mitre.org/data/definitions/401.html | safe |
void crypto_bignum_free(struct bignum **a)
{
if (a && *a)
panic();
} | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_allocate_keypair(struct dh_keypair *key, size_t size_bits)
{
DH_TRACE("Allocate Keypair of %zu bits", size_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Generator Scalar */
key->g = crypto_bignum_allocate(size_bits);
if (!key->g)
goto err;
/* A... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_allocate_publickey(struct dsa_public_key *key,
size_t l_bits, size_t n_bits)
{
DSA_TRACE("DSA Allocate Public of L=%zu bits and N=%zu bits", l_bits,
n_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Generator Scalar */
key->g = crypto_bignum_... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_allocate_keypair(struct dsa_keypair *key, size_t l_bits,
size_t n_bits)
{
DSA_TRACE("DSA allocate Keypair of L=%zu bits and N=%zu bits", l_bits,
n_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Generator Scalar */
key->g = crypto_bignum... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_allocate_publickey(struct ecc_public_key *key,
uint32_t type __unused,
size_t size_bits)
{
ECC_TRACE("Allocate Public Key of %zu bits", size_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Public coordinate X */
key->x = crypto_bignum_alloca... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static void do_free_publickey(struct ecc_public_key *key)
{
crypto_bignum_free(&key->x);
crypto_bignum_free(&key->y);
} | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_allocate_keypair(struct ecc_keypair *key,
uint32_t type __unused,
size_t size_bits)
{
ECC_TRACE("Allocate Keypair of %zu bits", size_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Secure Scalar */
key->d = crypto_bignum_allocate(s... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static void do_free_keypair(struct rsa_keypair *key)
{
crypto_bignum_free(&key->e);
crypto_bignum_free(&key->d);
crypto_bignum_free(&key->n);
crypto_bignum_free(&key->p);
crypto_bignum_free(&key->q);
crypto_bignum_free(&key->qp);
crypto_bignum_free(&key->dp);
crypto_bignum_free(&key->dq);
} | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static void do_free_publickey(struct rsa_public_key *key)
{
crypto_bignum_free(&key->e);
crypto_bignum_free(&key->n);
} | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_allocate_publickey(struct rsa_public_key *key,
size_t size_bits)
{
RSA_TRACE("Allocate Public Key of %zu bits", size_bits);
/* Initialize all input key fields to 0 */
memset(key, 0, sizeof(*key));
/* Allocate the Public Exponent to maximum size */
key->e = crypto_bignum_allocate(MAX_BIT... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static void do_free_publickey(struct ecc_public_key *s)
{
if (!s)
return;
crypto_bignum_free(&s->x);
crypto_bignum_free(&s->y);
} | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_alloc_publickey(struct ecc_public_key *s, uint32_t type,
size_t size_bits __unused)
{
/* This driver only supports ECDH/ECDSA */
if (type != TEE_TYPE_ECDSA_PUBLIC_KEY &&
type != TEE_TYPE_ECDH_PUBLIC_KEY)
return TEE_ERROR_NOT_IMPLEMENTED;
memset(s, 0, sizeof(*s));
if (!bn_alloc_... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_alloc_keypair(struct ecc_keypair *s, uint32_t type,
size_t size_bits __unused)
{
/* This driver only supports ECDH/ECDSA */
if (type != TEE_TYPE_ECDSA_KEYPAIR &&
type != TEE_TYPE_ECDH_KEYPAIR)
return TEE_ERROR_NOT_IMPLEMENTED;
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->d))
... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_alloc_keypair(struct rsa_keypair *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->e))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->d))
goto err;
if (!bn_alloc_max(&s->n))
goto err;
if (!bn_alloc_max(&s->p))
goto err;
if (!bn_alloc_ma... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static void do_free_publickey(struct rsa_public_key *s)
{
if (s) {
crypto_bignum_free(&s->n);
crypto_bignum_free(&s->e);
}
} | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static void do_free_keypair(struct rsa_keypair *s)
{
sss_status_t st = kStatus_SSS_Fail;
sss_se05x_object_t k_object = { };
uint32_t key_id = 0;
if (!s)
return;
key_id = se050_rsa_keypair_from_nvm(s);
if (key_id) {
st = sss_se05x_key_object_get_handle(&k_object, key_id);
if (st == kStatus_SSS_Success)
... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
static TEE_Result do_alloc_publickey(struct rsa_public_key *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->e))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->n)) {
crypto_bignum_free(&s->e);
return TEE_ERROR_OUT_OF_MEMORY;
}
return TEE_SUCCESS;
} | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
TEE_Result crypto_acipher_alloc_dh_keypair(struct dh_keypair *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->g))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->p))
goto err;
if (!bn_alloc_max(&s->y))
goto err;
if (!bn_alloc_max(&s->x))
goto err;
if (!bn_... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
TEE_Result crypto_acipher_alloc_dsa_public_key(struct dsa_public_key *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->g))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->p))
goto err;
if (!bn_alloc_max(&s->q))
goto err;
if (!bn_alloc_max(&s->y))
goto e... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
TEE_Result crypto_acipher_alloc_dsa_keypair(struct dsa_keypair *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->g))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->p))
goto err;
if (!bn_alloc_max(&s->q))
goto err;
if (!bn_alloc_max(&s->y))
goto err;
if (... | 1 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | safe |
msg_puts_printf(char_u *str, int maxlen)
{
char_u *s = str;
char_u *buf = NULL;
char_u *p = s;
#ifdef MSWIN
if (!(silent_mode && p_verbose == 0))
mch_settmode(TMODE_COOK); // handle CR and NL correctly
#endif
while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
{
if (!(silent_mode && ... | 0 | C | CWE-122 | Heap-based Buffer Overflow | A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc(). | https://cwe.mitre.org/data/definitions/122.html | vulnerable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.