1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-02 06:48:04 +00:00

Address similar issue to #86

buffer/blit could trigger a use after free if a buffer is
blitted with itself and modifies its length.
This commit is contained in:
Calvin Rose
2019-05-08 08:55:43 -04:00
parent ff720f1320
commit 65ac17986a
2 changed files with 10 additions and 0 deletions

View File

@@ -46,6 +46,14 @@
(assert (= txs '[[-1 -1] [-1 0] [-1 1] [0 -1] [0 1] [1 -1] [1 0] [1 1]]) "nested seq")
# Buffer self blitting, check for use after free
(def buf1 @"1234567890")
(buffer/blit buf1 buf1 -1)
(buffer/blit buf1 buf1 -1)
(buffer/blit buf1 buf1 -1)
(buffer/blit buf1 buf1 -1)
(assert (= (string buf1) (string/repeat "1234567890" 16)) "buffer blit against self")
# Generators
(def gen (generate [x :range [0 100] :when (pos? (% x 4))] x))
(var gencount 0)