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

Some issues reported by Coverity Scan #15

Open
epico opened this issue Jun 17, 2021 · 1 comment
Open

Some issues reported by Coverity Scan #15

epico opened this issue Jun 17, 2021 · 1 comment

Comments

@epico
Copy link

epico commented Jun 17, 2021

Here are some reports from Coverity Scan for libthai-0.1.28.

1. Defect type: GCC_ANALYZER_WARNING
1. libthai-0.1.28/src/thbrk/brk-maximal.c:0: scope_hint: In function 'best_brk_new'
2. libthai-0.1.28/src/thbrk/brk-maximal.c:642:5: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
#   640|   
#   641|   exit1:
#   642|->     free (best_brk);
#   643|       return NULL;
#   644|   }
2. Defect type: GCC_ANALYZER_WARNING
1. libthai-0.1.28/src/thbrk/brk-maximal.c:598:16: warning[-Wanalyzer-null-dereference]: dereference of NULL 'node'
18. libthai-0.1.28/src/thbrk/brk-maximal.c:36: included_from: Included from here.
20. libthai-0.1.28/src/thbrk/thbrk-utils.h:32:46: note: in definition of macro 'UNLIKELY'
22. libthai-0.1.28/src/thbrk/thbrk-utils.h:32:46: note: in definition of macro 'UNLIKELY'
26. libthai-0.1.28/src/thbrk/brk-maximal.c:36: included_from: Included from here.
28. libthai-0.1.28/src/thbrk/thbrk-utils.h:32:46: note: in definition of macro 'UNLIKELY'
51. libthai-0.1.28/src/thbrk/brk-maximal.c:31: included_from: Included from here.
#   596|   brk_pool_add (BrkPool *pool, BrkPool *node)
#   597|   {
#   598|->     node->next = pool;
#   599|       return node;
#   600|   }
3. Defect type: GCC_ANALYZER_WARNING
1. libthai-0.1.28/src/thbrk/brk-maximal.c:0: scope_hint: In function 'brk_recover_try'
2. libthai-0.1.28/src/thbrk/brk-maximal.c:598:16: warning[-Wanalyzer-malloc-leak]: leak of '<unknown>'
19. libthai-0.1.28/src/thbrk/brk-maximal.c:36: included_from: Included from here.
21. libthai-0.1.28/src/thbrk/thbrk-utils.h:32:46: note: in definition of macro 'UNLIKELY'
23. libthai-0.1.28/src/thbrk/thbrk-utils.h:32:46: note: in definition of macro 'UNLIKELY'
29. libthai-0.1.28/src/thbrk/brk-maximal.c:36: included_from: Included from here.
31. libthai-0.1.28/src/thbrk/thbrk-utils.h:32:46: note: in definition of macro 'UNLIKELY'
53. libthai-0.1.28/src/thbrk/brk-maximal.c:31: included_from: Included from here.
#   596|   brk_pool_add (BrkPool *pool, BrkPool *node)
#   597|   {
#   598|->     node->next = pool;
#   599|       return node;
#   600|   }

Does the above defect mean some issue or just false alert?

@thep
Copy link
Contributor

thep commented Oct 31, 2021

I don't quite understand what clues the scanning results give us. But I can see two places where brk_pool_add() could be passed NULL as node, one in brk_maximal_do_impl() and the other in brk_recover_try(), where the result of brk_pool_node_new() is not checked.

I'll try to handle these cases.

thep added a commit that referenced this issue Oct 31, 2021
* src/thbrk/brk-maximal.c (brk_maximal_do_impl, brk_recover_try):
  - Handle cases where brk_pool_node_new() possibly returns NULL.
    In both places, fail gracefully by behaving as if the dict state
    were single there.

Partially addresses Issue #15.
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

2 participants