[wiki] [sites] [st][patch][ligatures] Fix realloc crash in hb.c || Alexander Rogachev
commit ca3f09c6f44f13df7a2976cb502ff4331cd237a1
Author: Alexander Rogachev <sorryforbadname_AT_gmail.com>
Date: Sat May 13 21:35:11 2023 +0400
[st][patch][ligatures] Fix realloc crash in hb.c
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
index 4b6c8cb4..eeb39d06 100644
--- 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
_AT_@ -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
index ddee323b..cd545781 100644
--- 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
_AT_@ -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
index e49bc9d3..435e3b4b 100644
--- 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
_AT_@ -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
index b4a23522..cfc20c93 100644
--- 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
_AT_@ -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
index 6191e7fd..20c78f9e 100644
--- 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
_AT_@ -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
index 9255c55a..f3e126d2 100644
--- 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
_AT_@ -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
index 69652198..bb809434 100644
--- 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
_AT_@ -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. */
Received on Sat May 13 2023 - 19:32:52 CEST
This archive was generated by hypermail 2.3.0
: Sat May 13 2023 - 19:36:50 CEST