diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-05-30 08:12:49 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2025-05-30 08:12:49 +0100 |
commit | 4dc3d8f8325994d737f1959c1554480f4ccbc60f (patch) | |
tree | 0636c4fc330b6772e5ea12defa7d6f5d108f11e0 /oats.org | |
parent | bfff660d0e1a03063b889f84e8cfd046565c6046 (diff) | |
download | oats-4dc3d8f8325994d737f1959c1554480f4ccbc60f.tar.gz oats-4dc3d8f8325994d737f1959c1554480f4ccbc60f.tar.bz2 oats-4dc3d8f8325994d737f1959c1554480f4ccbc60f.zip |
Fix issue with memory allocations in lisp::serialise
Was to do with sv_make.
Diffstat (limited to 'oats.org')
-rw-r--r-- | oats.org | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -4,15 +4,6 @@ #+FILETAGS: :oats: * Issues :issues: -** TODO Fix issue with memcpy overlap when string concatenating -[[file:lisp/lisp.c::// FIXME: Something is going wrong here!]] - -Ideas on what's going wrong: -- String sizes seem off -- Maybe something is wrong with arena allocator; we use - [[file:lib/sv.c::newsv.data = arena_realloc(allocator, sv.data, - sv.size, newsv.size);][arena_realloc]] which seems to be the root of - the memcpy-overlap * Features :features: ** WIP Reader :reader: We want something a bit generic: able to handle reading from some @@ -205,3 +196,18 @@ more work than the lowest byte (to look at it we'll need to push that byte all the way down). So we'll be going for a low byte strategy by shifting the pointer up by one byte. This leaves us with the lowest byte to play with as we choose. +** DONE Fix issue with memcpy overlap when string concatenating +[[file:lisp/lisp.c::// FIXME: Something is going wrong here!]] + +Ideas on what's going wrong: +- String sizes seem off +- Maybe something is wrong with arena allocator; we use + [[file:lib/sv.c::newsv.data = arena_realloc(allocator, sv.data, + sv.size, newsv.size);][arena_realloc]] which seems to be the root of + the memcpy-overlap + +2025-05-30 08:11:24: Was an issue with ~sv_make~; if you pass a data +pointer, it will try to copy the size you passed as bytes from the +pointer. In ~sv_concat~ we pass the overall new size of the string +we're allocating and pass in the first argument to copy in the initial +part of the data first. |