pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
yasr: fix memcpy overlaps
Module Name: pkgsrc-wip
Committed By: adr <adr%sdf.org@localhost>
Pushed By: adr
Date: Sun Mar 3 20:45:46 2024 +0000
Changeset: 6b575c14446988eeafeb900ac8fb6eb442b2f078
Modified Files:
yasr/distinfo
yasr/patches/patch-yasr_main.c
Log Message:
yasr: fix memcpy overlaps
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=6b575c14446988eeafeb900ac8fb6eb442b2f078
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
yasr/distinfo | 2 +-
yasr/patches/patch-yasr_main.c | 36 ++++++++++++++++++++++--------------
2 files changed, 23 insertions(+), 15 deletions(-)
diffs:
diff --git a/yasr/distinfo b/yasr/distinfo
index 8b1038613b..b5324e7146 100644
--- a/yasr/distinfo
+++ b/yasr/distinfo
@@ -4,7 +4,7 @@ BLAKE2s (yasr-0.0.0.144-f60db19350542e6f4b7d268a310b9f2b9f3076c0.tar.gz) = 72d9f
SHA512 (yasr-0.0.0.144-f60db19350542e6f4b7d268a310b9f2b9f3076c0.tar.gz) = 1a97f4d18586e9e72a01b05b0c6240a7e346b44d920771d662a0cbf9cba26467732d5681f391938d01cf0bd9e269bf0879fd7fcbf48f9678b5eafa30cbecca63
Size (yasr-0.0.0.144-f60db19350542e6f4b7d268a310b9f2b9f3076c0.tar.gz) = 99434 bytes
SHA1 (patch-meson.build) = 81c27075691073e33799681441e4662275e62d3a
-SHA1 (patch-yasr_main.c) = 4fe18d9741f962a699fe64f1c680d267fbc68de2
+SHA1 (patch-yasr_main.c) = a8c406c6703f31471f4c607ea404134cdb0b5f86
SHA1 (patch-yasr_tts.c) = 67656ad2e02a734deb136c56bf3e2ea79989b005
SHA1 (patch-yasr_yasr.conf) = 73157a2dec79cb39050a4617af99e59349ca9531
SHA1 (patch-yasr_yasr.h) = 68c15be283d0c21e94d0acf890cbea95634b5827
diff --git a/yasr/patches/patch-yasr_main.c b/yasr/patches/patch-yasr_main.c
index bf49cc7cac..b1fa3e631e 100644
--- a/yasr/patches/patch-yasr_main.c
+++ b/yasr/patches/patch-yasr_main.c
@@ -60,7 +60,7 @@ Remove the enforcing of UTF-8
if (size <= 0)
{
finish (0);
-@@ -533,19 +523,19 @@ oldgulp (unsigned char *buf, int *size,
+@@ -533,41 +523,44 @@ oldgulp (unsigned char *buf, int *size,
if (ep)
{
n = buf + *size - *ep;
@@ -84,7 +84,11 @@ Remove the enforcing of UTF-8
buf[*size] = '\0';
return ((char *) (buf + os));
}
-@@ -556,18 +546,19 @@ oldgulp (unsigned char *buf, int *size,
+
+ #endif
+
+-/*!
++/*
function reads portion of data into buf and converts
to wide string, leaving 'leave' character in wide_buf;
*/
@@ -96,21 +100,24 @@ Remove the enforcing of UTF-8
{
- char *b1, *b2;
- size_t s1, s2;
+- if (bytes_left)
+- {
+- memcpy (buf, bytes_left_start, bytes_left);
+ int mbcharsize;
-+ char *bmb;
-+ wchar_t *bwc;
++ char *bmb, tmpch[BUF_MAX];
++ wchar_t *bwc, tmpwc[WIDE_BUF_MAX];
+ size_t smb;
+
- if (bytes_left)
-- {
- memcpy (buf, bytes_left_start, bytes_left);
-- }
++ if (bytes_left){
++ memcpy (tmpch, bytes_left_start, bytes_left);
++ memcpy (buf, tmpch, bytes_left);
+ }
- size = read (master, buf + bytes_left, 255 - bytes_left - leave);
+ size = read (master, buf + bytes_left, BUF_MAX - bytes_left - 1);
if (size < 0)
{
perror ("read");
-@@ -577,32 +568,44 @@ read_buf (int leave)
+@@ -577,32 +570,45 @@ read_buf (int leave)
size += bytes_left;
buf[size] = 0;
bytes_left = 0;
@@ -128,9 +135,10 @@ Remove the enforcing of UTF-8
- if (iconv (ih_inp, &b1, &s1, &b2, &s2) == (size_t) -1)
+ bmb = buf;
+ bwc = wide_buf + leave;
-+ if (leave != 0 && leave < wsize)
-+ //memcpy (wide_buf, wide_buf + wsize - leave, sizeof (wchar_t) * leave);
-+ wmemcpy (wide_buf, wide_buf + wsize - leave, leave);
++ if (leave != 0 && leave < wsize){
++ memcpy (tmpwc, wide_buf + wsize - leave, sizeof (wchar_t) * leave);
++ memcpy (wide_buf, tmpwc, sizeof (wchar_t) * leave);
++ }
+ smb = size;
+ wsize = 0;
+ while (smb > 0 && wsize < (WIDE_BUF_MAX - 1))
@@ -175,7 +183,7 @@ Remove the enforcing of UTF-8
wide_buf[wsize] = 0;
}
-@@ -1253,6 +1256,7 @@ getoutput ()
+@@ -1253,6 +1259,7 @@ getoutput ()
tts.oflag = oldoflag;
}
}
@@ -183,7 +191,7 @@ Remove the enforcing of UTF-8
if (ch == 13 || ch == 10 || ch == 32)
{
tts_flush ();
-@@ -1470,17 +1474,6 @@ main (int argc, char *argv[])
+@@ -1470,17 +1477,6 @@ main (int argc, char *argv[])
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
textdomain (GETTEXT_PACKAGE);
strcpy (charmap, nl_langinfo (CODESET));
Home |
Main Index |
Thread Index |
Old Index