sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 05a0d9b6bf500a7b2955c4299a1912eb302ce40b
parent 8ddf8523e8eec6b94f905c895a62c5d5b266af04
Author: Alexander Rogachev <sorryforbadname@gmail.com>
Date:   Mon,  4 Jul 2022 22:51:37 +0300

[st][patch][ligatures] fix potential buffer overflow in shaping code

Diffstat:
Mst.suckless.org/patches/ligatures/0.8.4/st-ligatures-20210824-0.8.4.diff | 11++++++-----
Mst.suckless.org/patches/ligatures/0.8.4/st-ligatures-alpha-20210824-0.8.4.diff | 9+++++----
Mst.suckless.org/patches/ligatures/0.8.4/st-ligatures-alpha-scrollback-20210824-0.8.4.diff | 9+++++----
Mst.suckless.org/patches/ligatures/0.8.4/st-ligatures-boxdraw-20210824-0.8.4.diff | 9+++++----
Mst.suckless.org/patches/ligatures/0.8.4/st-ligatures-scrollback-20210824-0.8.4.diff | 9+++++----
5 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-20210824-0.8.4.diff b/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-20210824-0.8.4.diff @@ -45,7 +45,7 @@ new file mode 100644 index 0000000..6389e95 --- /dev/null +++ b/hb.c -@@ -0,0 +1,145 @@ +@@ -0,0 +1,146 @@ +#include <stdlib.h> +#include <stdio.h> +#include <math.h> @@ -69,11 +69,12 @@ index 0000000..6389e95 +static int hbfontslen = 0; +static HbFontMatch *hbfontcache = NULL; + -+/* -+ * Replace 0 with a list of font features, wrapped in FEATURE macro, e.g. ++/* ++ * Poplulate the array with a list of font features, wrapped in FEATURE macro, ++ * e. g. + * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g') + */ -+hb_feature_t features[] = { 0 }; ++hb_feature_t features[] = { }; + +void +hbunloadfonts() @@ -177,7 +178,7 @@ index 0000000..6389e95 + } + + /* Shape the segment. */ -+ hb_shape(font, buffer, features, sizeof(features)); ++ hb_shape(font, buffer, features, sizeof(features)/sizeof(hb_feature_t)); + + /* Get new glyph info. */ + hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, NULL); diff --git a/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-alpha-20210824-0.8.4.diff b/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-alpha-20210824-0.8.4.diff @@ -45,7 +45,7 @@ new file mode 100644 index 0000000..f9c4f76 --- /dev/null +++ b/hb.c -@@ -0,0 +1,144 @@ +@@ -0,0 +1,145 @@ +#include <stdlib.h> +#include <stdio.h> +#include <math.h> @@ -69,10 +69,11 @@ index 0000000..f9c4f76 +static HbFontMatch *hbfontcache = NULL; + +/* -+ * Replace 0 with a list of font features, wrapped in FEATURE macro, e.g. ++ * Poplulate the array with a list of font features, wrapped in FEATURE macro, ++ * e. g. + * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g') + */ -+hb_feature_t features[] = { 0 }; ++hb_feature_t features[] = { }; + +void +hbunloadfonts() @@ -176,7 +177,7 @@ index 0000000..f9c4f76 + } + + /* Shape the segment. */ -+ hb_shape(font, buffer, features, sizeof(features)); ++ hb_shape(font, buffer, features, sizeof(features)/sizeof(hb_feature_t)); + + /* Get new glyph info. */ + hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, NULL); diff --git a/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-alpha-scrollback-20210824-0.8.4.diff b/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-alpha-scrollback-20210824-0.8.4.diff @@ -45,7 +45,7 @@ new file mode 100644 index 0000000..f9c4f76 --- /dev/null +++ b/hb.c -@@ -0,0 +1,144 @@ +@@ -0,0 +1,145 @@ +#include <stdlib.h> +#include <stdio.h> +#include <math.h> @@ -69,10 +69,11 @@ index 0000000..f9c4f76 +static HbFontMatch *hbfontcache = NULL; + +/* -+ * Replace 0 with a list of font features, wrapped in FEATURE macro, e.g. ++ * Poplulate the array with a list of font features, wrapped in FEATURE macro, ++ * e. g. + * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g') + */ -+hb_feature_t features[] = { 0 }; ++hb_feature_t features[] = { }; + +void +hbunloadfonts() @@ -176,7 +177,7 @@ index 0000000..f9c4f76 + } + + /* Shape the segment. */ -+ hb_shape(font, buffer, features, sizeof(features)); ++ hb_shape(font, buffer, features, sizeof(features)/sizeof(hb_feature_t)); + + /* Get new glyph info. */ + hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, NULL); diff --git a/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-boxdraw-20210824-0.8.4.diff b/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-boxdraw-20210824-0.8.4.diff @@ -45,7 +45,7 @@ new file mode 100644 index 0000000..a47300e --- /dev/null +++ b/hb.c -@@ -0,0 +1,148 @@ +@@ -0,0 +1,149 @@ +#include <stdlib.h> +#include <stdio.h> +#include <math.h> @@ -69,10 +69,11 @@ index 0000000..a47300e +static HbFontMatch *hbfontcache = NULL; + +/* -+ * Replace 0 with a list of font features, wrapped in FEATURE macro, e.g. ++ * Poplulate the array with a list of font features, wrapped in FEATURE macro, ++ * e. g. + * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g') + */ -+hb_feature_t features[] = { 0 }; ++hb_feature_t features[] = { }; + +void +hbunloadfonts() @@ -180,7 +181,7 @@ index 0000000..a47300e + } + + /* Shape the segment. */ -+ hb_shape(font, buffer, features, sizeof(features)); ++ hb_shape(font, buffer, features, sizeof(features)/sizeof(hb_feature_t)); + + /* Get new glyph info. */ + hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, NULL); diff --git a/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-scrollback-20210824-0.8.4.diff b/st.suckless.org/patches/ligatures/0.8.4/st-ligatures-scrollback-20210824-0.8.4.diff @@ -45,7 +45,7 @@ new file mode 100644 index 0000000..f9c4f76 --- /dev/null +++ b/hb.c -@@ -0,0 +1,144 @@ +@@ -0,0 +1,145 @@ +#include <stdlib.h> +#include <stdio.h> +#include <math.h> @@ -69,10 +69,11 @@ index 0000000..f9c4f76 +static HbFontMatch *hbfontcache = NULL; + +/* -+ * Replace 0 with a list of font features, wrapped in FEATURE macro, e.g. ++ * Poplulate the array with a list of font features, wrapped in FEATURE macro, ++ * e. g. + * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g') + */ -+hb_feature_t features[] = { 0 }; ++hb_feature_t features[] = { }; + +void +hbunloadfonts() @@ -176,7 +177,7 @@ index 0000000..f9c4f76 + } + + /* Shape the segment. */ -+ hb_shape(font, buffer, features, sizeof(features)); ++ hb_shape(font, buffer, features, sizeof(features)/sizeof(hb_feature_t)); + + /* Get new glyph info. */ + hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, NULL);