Package: tetradraw
Version: all
Severity: grave
Hi All, I run Arch not Debian.
However, I do a lot of console programming and testing with ANSI and BBS
Software.
I noticed when I was compiling an older version of Tetradraw that it crashed
right away after typing a few characters on the screen canvas.
When I dug through the code I found an issue with the memory allocation for
the canvas and that problem still exists in the latest version.
In file: internal.c both the allocate and re-allocate do the following.
/* this function is a wrapper for malloc
* it makes sure that malloc doesnt return NULL */
void *m_malloc(size_t size) {
void *p = (void *)NULL;
p = malloc(size);
if (!p) {
fprintf(stderr, "ERROR: malloc of %d bytes failed\n", size);
fprintf(stderr, "Exiting...\n");
exit(-1);
}
return p;
}
/* this is a wrapper for realloc */
void *m_realloc(void *p, size_t size) {
p = realloc(p, size);
return p;
}
===================================================================
p = malloc(size); // This does not allocate enough space
per each character.
This needs to be changed to:
p = malloc(size * sizeof(int)); // For 32/64 bit
p = malloc(size * sizeof(int32_t)); // UTF8
Thanks,
Michael Griffin
<[email protected]>