test/rsa_test.c:375: error: BUFFER_OVERRUN_L3
  Offset: [-7, 7] Size: 8.
Showing all 6 steps of the trace


test/rsa_test.c:354:1: <Offset trace>
352.   };
353.   
354. > static int test_rsa_security_bit(int n)
355.   {
356.       static const unsigned char vals[8] = {

test/rsa_test.c:354:1: Global `rsa_security_bits_cases.bits`
352.   };
353.   
354. > static int test_rsa_security_bit(int n)
355.   {
356.       static const unsigned char vals[8] = {

test/rsa_test.c:360:5: Assignment
358.       };
359.       RSA *key = RSA_new();
360.       const int bits = rsa_security_bits_cases[n].bits;
           ^
361.       const int result = rsa_security_bits_cases[n].r;
362.       const int bytes = (bits + 7) / 8;

test/rsa_test.c:356:5: <Length trace>
354.   static int test_rsa_security_bit(int n)
355.   {
356.       static const unsigned char vals[8] = {
           ^
357.           0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40
358.       };

test/rsa_test.c:356:5: Array declaration
354.   static int test_rsa_security_bit(int n)
355.   {
356.       static const unsigned char vals[8] = {
           ^
357.           0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40
358.       };

test/rsa_test.c:375:17: Array access: Offset: [-7, 7] Size: 8
373.        * the RSA key is never used.
374.        */
375.       memset(num, vals[bits % 8], bytes);
                       ^
376.   
377.       /*

static int test_rsa_security_bit(int n)
{
    static const unsigned char vals[8] = {
        0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40
    };
    RSA *key = RSA_new();
    const int bits = rsa_security_bits_cases[n].bits;
    const int result = rsa_security_bits_cases[n].r;
    const int bytes = (bits + 7) / 8;
    int r = 0;
    unsigned char num[2000];
    if (!TEST_ptr(key) || !TEST_int_le(bytes, (int)sizeof(num)))
        goto err;
    memset(num, vals[bits % 8], bytes);
    if (TEST_true(RSA_set0_key(key, BN_bin2bn(num, bytes, NULL),
                               BN_bin2bn(num, bytes, NULL), NULL))
            && TEST_uint_eq(RSA_security_bits(key), result))
        r = 1;
err:
    RSA_free(key);
    return r;
}
['static int test_rsa_security_bit(int n)\n{\n    static const unsigned char vals[8] = {\n        0x80, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40\n    };\n    RSA *key = RSA_new();\n    const int bits = rsa_security_bits_cases[n].bits;\n    const int result = rsa_security_bits_cases[n].r;\n    const int bytes = (bits + 7) / 8;\n    int r = 0;\n    unsigned char num[2000];\n    if (!TEST_ptr(key) || !TEST_int_le(bytes, (int)sizeof(num)))\n        goto err;\n    memset(num, vals[bits % 8], bytes);\n    if (TEST_true(RSA_set0_key(key, BN_bin2bn(num, bytes, NULL),\n                               BN_bin2bn(num, bytes, NULL), NULL))\n            && TEST_uint_eq(RSA_security_bits(key), result))\n        r = 1;\nerr:\n    RSA_free(key);\n    return r;\n}']