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

[CWE-690] gl4dmTriangleEdge gl4dm.c #15

Closed
darnuria opened this issue Oct 24, 2020 · 4 comments
Closed

[CWE-690] gl4dmTriangleEdge gl4dm.c #15

darnuria opened this issue Oct 24, 2020 · 4 comments

Comments

@darnuria
Copy link
Collaborator

Dereference possible du pointeur NULL reproduction via ajout de -fanalyzer comme en #11 avec gcc 10

GL4D/gl4dm.c: In functiongl4dmTriangleEdge’:
GL4D/gl4dm.c:129:9: warning: dereference of possibly-NULLhm’ [CWE-690] [-Wanalyzer-possible-null-dereference]
  129 |   hm[0] = GL4DM_EPSILON + gl4dmURand();
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘gl4dmTriangleEdge’: events 1-2
    |
    |  128 |   GLfloat * hm = calloc(width * height, sizeof *hm);
    |      |                         ~~~~~~^~~~~~~~
    |      |                               |
    |      |                               (1) this call could return NULL
    |  129 |   hm[0] = GL4DM_EPSILON + gl4dmURand();
    |      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |         |
    |      |         (2) ‘hmcould be NULL: unchecked value from (1)
    |
@fiplox
Copy link
Contributor

fiplox commented Feb 6, 2021

Un assert sur hm doit corriger ce warning

@darnuria
Copy link
Collaborator Author

darnuria commented Feb 7, 2021

@Marobax envie de faire une PR? :0

@Marobax
Copy link
Contributor

Marobax commented Feb 11, 2021

Je m'y met dès que j'ai le temps, @darnuria :)

@Marobax
Copy link
Contributor

Marobax commented Feb 24, 2021

J'en ai mis du temps, mais je viens de le faire. Tu peux aller check la PR #32, @darnuria

@noalien noalien closed this as completed May 3, 2021
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

No branches or pull requests

4 participants