commit ca3f09c6f44f13df7a2976cb502ff4331cd237a1 parent 6a0f40912b37860fc65029def8b5273b19ef8e11 Author: Alexander Rogachev <sorryforbadname@gmail.com> Date: Sat, 13 May 2023 21:35:11 +0400 [st][patch][ligatures] Fix realloc crash in hb.c Diffstat:
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/st.suckless.org/patches/ligatures/0.9/st-ligatures-20230105-0.9.diff b/st.suckless.org/patches/ligatures/0.9/st-ligatures-20230105-0.9.diff @@ -140,7 +140,7 @@ index 0000000..528c040 + /* Resize the buffer if required length is larger. */ + if (hbrunebuffer.capacity < length) { + hbrunebuffer.capacity = (length / BUFFER_STEP + 1) * BUFFER_STEP; -+ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity); ++ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity * sizeof(Rune)); + } + + /* Fill buffer with codepoints. */ diff --git a/st.suckless.org/patches/ligatures/0.9/st-ligatures-alpha-20230105-0.9.diff b/st.suckless.org/patches/ligatures/0.9/st-ligatures-alpha-20230105-0.9.diff @@ -141,7 +141,7 @@ index 0000000..528c040 + /* Resize the buffer if required length is larger. */ + if (hbrunebuffer.capacity < length) { + hbrunebuffer.capacity = (length / BUFFER_STEP + 1) * BUFFER_STEP; -+ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity); ++ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity * sizeof(Rune)); + } + + /* Fill buffer with codepoints. */ diff --git a/st.suckless.org/patches/ligatures/0.9/st-ligatures-alpha-scrollback-20230105-0.9.diff b/st.suckless.org/patches/ligatures/0.9/st-ligatures-alpha-scrollback-20230105-0.9.diff @@ -141,7 +141,7 @@ index 0000000..528c040 + /* Resize the buffer if required length is larger. */ + if (hbrunebuffer.capacity < length) { + hbrunebuffer.capacity = (length / BUFFER_STEP + 1) * BUFFER_STEP; -+ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity); ++ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity * sizeof(Rune)); + } + + /* Fill buffer with codepoints. */ diff --git a/st.suckless.org/patches/ligatures/0.9/st-ligatures-alpha-scrollback-ringbuffer-20230105-0.9.diff b/st.suckless.org/patches/ligatures/0.9/st-ligatures-alpha-scrollback-ringbuffer-20230105-0.9.diff @@ -141,7 +141,7 @@ index 0000000..528c040 + /* Resize the buffer if required length is larger. */ + if (hbrunebuffer.capacity < length) { + hbrunebuffer.capacity = (length / BUFFER_STEP + 1) * BUFFER_STEP; -+ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity); ++ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity * sizeof(Rune)); + } + + /* Fill buffer with codepoints. */ diff --git a/st.suckless.org/patches/ligatures/0.9/st-ligatures-boxdraw-20230105-0.9.diff b/st.suckless.org/patches/ligatures/0.9/st-ligatures-boxdraw-20230105-0.9.diff @@ -141,7 +141,7 @@ index 0000000..528c040 + /* Resize the buffer if required length is larger. */ + if (hbrunebuffer.capacity < length) { + hbrunebuffer.capacity = (length / BUFFER_STEP + 1) * BUFFER_STEP; -+ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity); ++ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity * sizeof(Rune)); + } + + /* Fill buffer with codepoints. */ diff --git a/st.suckless.org/patches/ligatures/0.9/st-ligatures-scrollback-20230105-0.9.diff b/st.suckless.org/patches/ligatures/0.9/st-ligatures-scrollback-20230105-0.9.diff @@ -140,7 +140,7 @@ index 0000000..528c040 + /* Resize the buffer if required length is larger. */ + if (hbrunebuffer.capacity < length) { + hbrunebuffer.capacity = (length / BUFFER_STEP + 1) * BUFFER_STEP; -+ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity); ++ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity * sizeof(Rune)); + } + + /* Fill buffer with codepoints. */ diff --git a/st.suckless.org/patches/ligatures/0.9/st-ligatures-scrollback-ringbuffer-20230105-0.9.diff b/st.suckless.org/patches/ligatures/0.9/st-ligatures-scrollback-ringbuffer-20230105-0.9.diff @@ -140,7 +140,7 @@ index 0000000..528c040 + /* Resize the buffer if required length is larger. */ + if (hbrunebuffer.capacity < length) { + hbrunebuffer.capacity = (length / BUFFER_STEP + 1) * BUFFER_STEP; -+ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity); ++ hbrunebuffer.runes = realloc(hbrunebuffer.runes, hbrunebuffer.capacity * sizeof(Rune)); + } + + /* Fill buffer with codepoints. */