[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tls
From: |
Daniel P . Berrangé |
Subject: |
Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509 |
Date: |
Tue, 2 Feb 2021 16:50:59 +0000 |
User-agent: |
Mutt/1.14.6 (2020-07-11) |
On Tue, Feb 02, 2021 at 08:50:24AM -0600, Eric Blake wrote:
> On 2/1/21 11:19 PM, Roman Bolshakov wrote:
>
> > After a session of debugging I believe there's an issue with Clang 12.
> > Here's a test program (it reproduces unexpected ASN1_VALUE_NOT_VALID
> > from _asn1_time_der() in libtasn1):
> >
> > #include <stdio.h>
> >
> > static int func2(char *foo) {
> > fprintf(stderr, "%s:%d foo: %p\n", __func__, __LINE__, foo);
> > if (foo == NULL) {
> > fprintf(stderr, "%s:%d foo: %p\n", __func__, __LINE__, foo);
> > return 1;
> > }
> > return 0;
> > }
> >
> > int func1(char *foo) {
> > int counter = 0;
> > if (fprintf(stderr, "IO\n") > 0)
> > counter += 10;
> > fprintf(stderr, "%s:%d foo: %p counter %d\n", __func__, __LINE__,
> > foo, counter);
> > if(!func2(foo + counter)) {
>
> This line has unspecified behavior in the C standard. Adding an integer
> to a pointer is only well-specified if the pointer is to an array and
> the integer is within the bounds or the slot just past the array. But
> since you called func1(NULL), foo is NOT pointing to an array, and
> therefore foo+counter points to garbage, and the compiler is free to
> optimize it at will.
>
> > fprintf(stderr, "good\n");
> > return 0;
> > } else {
> > fprintf(stderr, "broken\n");
> > return 1;
> > }
> > }
> >
> > int main() {
> > char *foo = NULL;
> > return func1(foo);
> > }
> >
> >
> > What return value would you expect from the program?
>
> Because the code is not strictly compliant to the C standard, I'm not
> sure what to expect.
Roman invented this example to illustrate the problem with libtasn1,
so I wonder if this suggests that libtasn1 is relying on undefined
C behaviour too.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Roman Bolshakov, 2021/02/02
- Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Christian Schoenebeck, 2021/02/02
- Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Eric Blake, 2021/02/02
- Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Christian Schoenebeck, 2021/02/02
- Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Eric Blake, 2021/02/02
- Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Stefan Weil, 2021/02/02
- Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Stefan Weil, 2021/02/02
- Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Daniel P . Berrangé, 2021/02/03
Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509,
Daniel P . Berrangé <=
Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509, Roman Bolshakov, 2021/02/03