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

Use gnu99 instead of c99, as strdup is not part of C99 #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lgruen
Copy link

@lgruen lgruen commented Oct 4, 2021

With c99 only, strdup is not defined (see https://stackoverflow.com/questions/26284110/strdup-confused-about-warnings-implicit-declaration-makes-pointer-with for context). Consequently,

if (destDir) dir = strdup(destDir);
assigns an invalid pointer value to dir, which cannot be read afterwards (e.g. using gcc 9 in the Ubuntu 20.04 Docker image), leading to a segfault. gcc warns about this:

/DRAGMAP-1.2.1/thirdparty/dragen/src/common/hash_generation/gen_hash_table.c: In function 'setDefaultHashParams':
/DRAGMAP-1.2.1/thirdparty/dragen/src/common/hash_generation/gen_hash_table.c:158:24: warning: implicit declaration of function 'strdup'; did you mean 'strcmp'? [-Wimplicit-function-declaration]
  158 |     if (destDir) dir = strdup(destDir);
      |                        ^~~~~~
      |                        strcmp
/DRAGMAP-1.2.1/thirdparty/dragen/src/common/hash_generation/gen_hash_table.c:158:22: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  158 |     if (destDir) dir = strdup(destDir);

edmundmiller pushed a commit to bioinformaticsorphanage/NARFMAP that referenced this pull request Dec 7, 2023
Illumina#10

Not sure if this is necessary, but it didn't break anything.
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.

1 participant