Re: 1.1.1 pre1 tests failing on Solaris SPARC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Would making buf a union also avoid the problem?

	union { unsigned long dummy[2]; char buf[DATA_BUF_SIZE]; } d
and then replace 'buf' with 'd.buf' in the code?


On 2/20/18, 12:00 AM, "Viktor Dukhovni" <openssl-users@xxxxxxxxxxxx> wrote:

    On Mon, Feb 19, 2018 at 01:45:26PM -0800, Norm Green wrote:
    
    > # ASN1_LONG_DATA:
    > #   success: TRUE
    > t@1 (l@1) signal BUS (invalid address alignment) in asn1_item_print_ctx at
    > line 155 in file "tasn_prn.c"
    >   155          || (it->utype != V_ASN1_BOOLEAN)) && *fld == NULL) {
    
    Perhaps aligning the item buffer (by using malloc) will help, does
    the patch below address the problem?
    
    diff --git a/test/asn1_encode_test.c b/test/asn1_encode_test.c
    index e9f459ad65..77fa9b5954 100644
    --- a/test/asn1_encode_test.c
    +++ b/test/asn1_encode_test.c
    @@ -709,15 +709,19 @@ static int do_encode_custom(EXPECTED *input,
     static int do_print_item(const TEST_PACKAGE *package)
     {
     #define DATA_BUF_SIZE 256
    -    unsigned char buf[DATA_BUF_SIZE];
         const ASN1_ITEM *i = ASN1_ITEM_ptr(package->asn1_type);
    -    ASN1_VALUE *o = (ASN1_VALUE *)&buf;
    +    ASN1_VALUE *o = OPENSSL_malloc(DATA_BUF_SIZE);
         int ret;
     
         OPENSSL_assert(package->encode_expectations_elem_size <= DATA_BUF_SIZE);
     
    -    (void)RAND_bytes(buf, (int)package->encode_expectations_elem_size);
    +    if (o == NULL)
    +        return 0;
    +
    +    (void)RAND_bytes((unsigned char *)o,
    +                     (int)package->encode_expectations_elem_size);
         ret = ASN1_item_print(bio_err, o, 0, i, NULL);
    +    OPENSSL_free(o);
     
         return ret;
     }
    
    -- 
    	Viktor.
    -- 
    openssl-users mailing list
    To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
    

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux