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

calloc2 #5

Open
obonaventure opened this issue Feb 26, 2018 · 2 comments
Open

calloc2 #5

obonaventure opened this issue Feb 26, 2018 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@obonaventure
Copy link
Contributor

Ce code passe tous les tests alors qu'il ne devrait pas (accès à un byte au-delà de la zone allouée)

char *ptr=(char )malloc((nmemb)(size));
if (ptr == 0){
return NULL;
}
int i;
for(i=0; i<nmemb; i++){
ptr[i] = 0 ;
}
ptr[nmemb]='\0';
return ptr;

@obonaventure obonaventure added the bug Something isn't working label Feb 26, 2018
@nrybowski
Copy link
Member

Il s'agit également d'une ancienne tâche qui n'utilise pas le framework CTester, il faudrait donc la modifier en ce sens. Il serait alors plus simple de vérifier ce genre de cas.

@nrybowski nrybowski added the enhancement New feature or request label Feb 26, 2018
@lodykas
Copy link

lodykas commented Feb 27, 2018

Je signale aussi que sur cette tâche, j'ai eu 2 étudiants du mardi 16H15 qui ont passé les tests sans réinitialiser la mémoire à 0; probablement qu'ils on eu de la chance avec le malloc, mais du coup les tests ne sont pas corrects.

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

No branches or pull requests

3 participants