Fix out-of-bounds access of argbs in render and reduce amount of memory allocation - vtv-tools - virtual terminal video tools
(HTM) git clone git://bitreich.org/vtv-tools git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/vtv-tools
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit 2451b8a24444b1a742590953b803e979a1be8482
(DIR) parent 9e02589616cb962968de2b2dbca952b449cc1b1d
(HTM) Author: Julian Schweinsberg <pazz0@0xfa.de>
Date: Wed, 16 Oct 2024 00:09:06 +0200
Fix out-of-bounds access of argbs in render and reduce amount of memory allocation
Diffstat:
M src/vtv-from-ff.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/src/vtv-from-ff.c b/src/vtv-from-ff.c
@@ -156,10 +156,10 @@ int convert(FILE *ff, FILE *vtv) {
if (load_ff(ff, &argbs, &width, &height) != 0) {
return 1;
}
- uint32_t *fgs = calloc(width*height, sizeof(uint32_t));
- uint32_t *bgs = calloc(width*height, sizeof(uint32_t));
- char *chars = calloc(width*height, sizeof(char));
- render(height, width, argbs, fgs, bgs, chars);
+ uint32_t *fgs = calloc(width*height/2, sizeof(uint32_t));
+ uint32_t *bgs = calloc(width*height/2, sizeof(uint32_t));
+ char *chars = calloc(width*height/2, sizeof(char));
+ render(height/2, width, argbs, fgs, bgs, chars);
display(vtv, height/2, width, fgs, bgs, chars);
free(argbs);
free(fgs);