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

[BUG] stack smashing detecte #13

Open
Hagbuck opened this issue Oct 17, 2017 · 3 comments
Open

[BUG] stack smashing detecte #13

Hagbuck opened this issue Oct 17, 2017 · 3 comments

Comments

@Hagbuck
Copy link
Owner

Hagbuck commented Oct 17, 2017

Pendant enregistrement d'une image PGM
*** stack smashing detected ***: <unknown> terminated Aborted (core dumped)
Dépassement mémoire.
La taille du tableau contenant la chaîne de caractères était définit par #define FILE_MAX_SIZE 2048. La valeur à été passé a 4096. Dans l'idéal il faudrait allouer la mémoire nécessaire plutôt que de passer par une constante.

@Hagbuck
Copy link
Owner Author

Hagbuck commented Oct 17, 2017

Tant que l'allocation mémoire ne sera pas dynamique, on ne pourra pas effectuer de test sur de grandes images

@Hagbuck Hagbuck self-assigned this Oct 17, 2017
@Hagbuck Hagbuck added the Doing label Oct 17, 2017
@Hagbuck
Copy link
Owner Author

Hagbuck commented Oct 17, 2017

La formule pour calculer la taille est
81 + 8*width*height + height

81

  • P2\n : 3 caractères
  • width, height : une ligne peut faire jusqu'à 70 caractères
  • v_max : Un entier ferra maximum 7 digits.

8widthheight + height

  • 8 : 7 digits pour un nombre + ' '
  • 8widthheight : pour chaque pixel
  • + height : on ajoute tout les retours chariot

C'est un peu trivial, il faudra trouver une solution pour avoir la taille en caractère de chaque digit plutôt que de partir du principe qu'il PEUT faire 7 caractères.

@Hagbuck
Copy link
Owner Author

Hagbuck commented Nov 11, 2017

Ou alors on enregistre l'image bloc par bloc (Actuellement le cas pour les BMP) plutôt que de charger toute l'image dans une chaîne de caractères. Il faut essayer les 2 et comparer les performances !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant