Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import-object: Avoid integer truncation on 32-bit platforms #609

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

ueno
Copy link
Member

@ueno ueno commented Dec 2, 2023

The build fails when compiling for 32-bit platforms with -Werror=incompatible-pointer-types:

  CFLAGS="-m32 -march=i686 -Werror=incompatible-pointer-types -Werror=implicit -Werror=int-conversion" setarch i686 -- meson setup _build
  setarch i686 -- meson compile -C _build -v
  ...

  ../p11-kit/import-object.c: In function ‘add_attrs_pubkey_rsa’:
  ../p11-kit/import-object.c:223:62: error: passing argument 3 of ‘p11_asn1_read’ from incompatible pointer type [-Werror=incompatible-pointer-types]
    223 |         attr_modulus.pValue = p11_asn1_read (asn, "modulus", &attr_modulus.ulValueLen);
        |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~
        |                                                              |
        |                                                              long unsigned int *

Fixes: #608

@coveralls
Copy link

coveralls commented Dec 2, 2023

Coverage Status

coverage: 69.447% (+0.003%) from 69.444%
when pulling d938f4a on ueno:wip/dueno/int-size
into 58cd1c0 on p11-glue:master.

p11-kit/import-object.c Outdated Show resolved Hide resolved
p11-kit/import-object.c Outdated Show resolved Hide resolved
The build fails when compiling for 32-bit platforms with
-Werror=incompatible-pointer-types:

  CFLAGS="-m32 -march=i686 -Werror=incompatible-pointer-types -Werror=implicit -Werror=int-conversion" setarch i686 -- meson setup _build
  setarch i686 -- meson compile -C _build -v
  ...

  ../p11-kit/import-object.c: In function ‘add_attrs_pubkey_rsa’:
  ../p11-kit/import-object.c:223:62: error: passing argument 3 of ‘p11_asn1_read’ from incompatible pointer type [-Werror=incompatible-pointer-types]
    223 |         attr_modulus.pValue = p11_asn1_read (asn, "modulus", &attr_modulus.ulValueLen);
        |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~
        |                                                              |
        |                                                              long unsigned int *

Reported by Sam James in:
p11-glue#608

Signed-off-by: Daiki Ueno <[email protected]>
Copy link
Contributor

@ZoltanFridrich ZoltanFridrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ueno ueno merged commit d49c92c into p11-glue:master Dec 4, 2023
14 checks passed
@ZoltanFridrich ZoltanFridrich added this to the 0.25.4 milestone Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build failure with stricter C compilers (e.g. GCC 14)
3 participants