Skip to content

checked-c-convert tool: struct variable containing a checked pointer not initialized #617

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

Closed
secure-sw-dev-bot opened this issue Jan 16, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@secure-sw-dev-bot
Copy link

This issue was copied from checkedc/checkedc-clang#621


I noticed this issue when converting the Icecast code. In the file src/thread/avl.c and various others.

The C compiler doesn't complain when a struct variable is not initialized, but the Checked C compiler does. The checked-c-convert tool doesn't give an warnings that an initialized struct variable was seen.

I created a small example for reference:

Original C code:

typedef struct _link_node {
  struct _link_node *parent;
  int width;
} link_node;

int add_to_link_node(link_node *node) {

  node->width += 5;

  return node->width;
}

int main() {

  link_node here;
  here.width = 10;

  return add_to_link_node(&here);
}

checked-c-convert output:

typedef struct _link_node {
  _Ptr<struct _link_node> parent;
  int width;
} link_node;

int add_to_link_node(_Ptr<link_node> node) {

  node->width += 5;

  return node->width;
}

int main() {

  link_node here;
  here.width = 10;

  return add_to_link_node(&here);
}

The checked-c-convert output will produce the error:
error: struct variable 'here' containing a checked pointer must have an initializer

@secure-sw-dev-bot secure-sw-dev-bot added the bug Something isn't working label Jan 16, 2022
@secure-sw-dev-bot
Copy link
Author

Comment from @Machiry:

This is a duplicate of the issue: correctcomputation/checkedc-clang#3 which we fixed in the plum repo: correctcomputation/checkedc-clang@6bdcacd and raised a pull-request (checkedc/checkedc-clang#679) for the same.

@secure-sw-dev-bot
Copy link
Author

Comment from @mgrang:

This is a duplicate of the issue: plum-umd#3 which we fixed in the plum repo: plum-umd@6bdcacd and raised a pull-request (#679) for the same.

@Machiry Could you please go ahead and close this issue since it's a duplicate?

@secure-sw-dev-bot
Copy link
Author

Comment from @Machiry:

I cannot close this. I am not the owner of this issue or the project. Could you close this, please!

@secure-sw-dev-bot
Copy link
Author

Comment from @hasantouma:

This issue is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant