Ok
— Antoine > On 16 Aug 2023, at 07:57, Stefan Hagen <sh+openbsd-po...@codevoid.de> wrote: > > Stuart Henderson wrote (2023-08-14 18:04 CEST): >>> On 2023/08/14 10:40, Antoine Jacoutot wrote: >>> On Mon, Aug 14, 2023 at 08:44:25AM +0200, Stefan Hagen wrote: >>>> Hi, >>>> >>>> there's a bug in gmime, which is affecting mail/mu. It doesn't look like >>>> there will be a new gmime release anytime soon. Can we cherry-pick this >>>> fix? >>>> >>>> Maintainer on CC. >>> >>> I am OK with this but could you use a regular patch instead of fetching from >>> github? >> >> +1 million >> > > Sure, here's the same as a regular patch. > > > Index: mail/gmime30/Makefile > =================================================================== > RCS file: /cvs/ports/mail/gmime30/Makefile,v > retrieving revision 1.23 > diff -u -p -u -p -r1.23 Makefile > --- mail/gmime30/Makefile 5 Nov 2022 17:06:28 -0000 1.23 > +++ mail/gmime30/Makefile 16 Aug 2023 05:53:40 -0000 > @@ -4,7 +4,7 @@ GH_ACCOUNT= jstedfast > GH_PROJECT= gmime > GH_TAGNAME= 3.2.13 > PKGNAME= gmime30-${GH_TAGNAME} > -REVISION= 0 > +REVISION= 1 > > SHARED_LIBS += gmime-3.0 2.2 # 213.0 > > Index: mail/gmime30/patches/patch-gmime_gmime-utils_c > =================================================================== > RCS file: mail/gmime30/patches/patch-gmime_gmime-utils_c > diff -N mail/gmime30/patches/patch-gmime_gmime-utils_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ mail/gmime30/patches/patch-gmime_gmime-utils_c 16 Aug 2023 05:53:40 > -0000 > @@ -0,0 +1,26 @@ > +Fix rfc2047 token decoding logic for base64 encodings > +Bug report: https://github.com/djcb/mu/issues/2429 > + > +Index: gmime/gmime-utils.c > +--- gmime/gmime-utils.c.orig > ++++ gmime/gmime-utils.c > +@@ -1789,10 +1789,16 @@ rfc2047_token_decode (rfc2047_token *token, unsigned > c > + const unsigned char *inbuf = (const unsigned char *) token->text; > + size_t len = token->length; > + > +- if (token->encoding == 'B') > ++ if (token->encoding == 'B') { > ++ /* Note: A state of -1 means that a previous rfc2047 encoded-word > token ended with an '=' (aka 'eof'), > ++ * so we need to reset the state. */ > ++ if (*state == -1) > ++ *state = 0; > ++ > + return g_mime_encoding_base64_decode_step (inbuf, len, outbuf, > state, save); > +- else > +- return quoted_decode (inbuf, len, outbuf, state, save); > ++ } > ++ > ++ return quoted_decode (inbuf, len, outbuf, state, save); > + } > + > + static char * > Index: mail/gmime30/patches/patch-tests_test-mime_c > =================================================================== > RCS file: /cvs/ports/mail/gmime30/patches/patch-tests_test-mime_c,v > retrieving revision 1.3 > diff -u -p -u -p -r1.3 patch-tests_test-mime_c > --- mail/gmime30/patches/patch-tests_test-mime_c 16 Apr 2022 07:34:04 > -0000 1.3 > +++ mail/gmime30/patches/patch-tests_test-mime_c 16 Aug 2023 05:53:40 -0000 > @@ -1,4 +1,4 @@ > -64bit time_t > +64bit time_t + Test for rfc2047 token decoding logic for base64 encodings > > Index: tests/test-mime.c > --- tests/test-mime.c.orig > @@ -12,3 +12,13 @@ Index: tests/test-mime.c > > if (tz_offset != dates[i].tzone) > throw (exception_new ("timezones do not match")); > +@@ -408,6 +408,9 @@ static struct { > + "blah:\tI am broken", > + "blah:\tI am broken" }, > + #endif > ++ { "=?UTF-8?B?SGVsbG8=?= =?UTF-8?B?IHdvcmxk?=", > ++ "Hello world", > ++ "Hello world" }, > + { "=?iso-8859-1?Q?Copy_of_Rapport_fra_Norges_R=E5fisklag=2Edoc?=", > + "Copy of Rapport fra Norges R\xc3\xa5" "fisklag.doc", > + "Copy of Rapport fra Norges =?iso-8859-1?q?R=E5fisklag=2Edoc?=" },