Skip to content

Commit

Permalink
fix performance issue with latin1 encoding
Browse files Browse the repository at this point in the history
when using OIDCPassClaimsAs <any> latin1; bump to 2.4.14.4rc1

Signed-off-by: Hans Zandbelt <[email protected]>
  • Loading branch information
zandbelt committed Sep 19, 2023
1 parent 3ae36c2 commit 3bcda42
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
09/19/2023
- fix performance issue with latin1 encoding when using OIDCPassClaimsAs <any> latin1
- bump to 2.4.14.4rc1

09/14/2023
- fix `OIDCRefreshAccessTokenBeforeExpiry` when using it with `logout_on_error` or `authenticate_on_error`
see #1111; thanks @brandonk10
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([mod_auth_openidc],[2.4.14.4rc0],[[email protected]])
AC_INIT([mod_auth_openidc],[2.4.14.4rc1],[[email protected]])

AC_SUBST(NAMEVER, AC_PACKAGE_TARNAME()-AC_PACKAGE_VERSION())

Expand Down
16 changes: 9 additions & 7 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2184,10 +2184,12 @@ static char* oidc_util_utf8_to_latin1(request_rec *r, const char *src) {
char *dst = "";
unsigned int cp = 0;
unsigned char ch;
int i = 0;
if (src == NULL)
return NULL;
while (*src != '\0') {
ch = (unsigned char) (*src);
dst = apr_pcalloc(r->pool, strlen(src) + 1);
while (src[i] != '\0') {
ch = (unsigned char) (src[i]);
if (ch <= 0x7f)
cp = ch;
else if (ch <= 0xbf)
Expand All @@ -2198,20 +2200,20 @@ static char* oidc_util_utf8_to_latin1(request_rec *r, const char *src) {
cp = ch & 0x0f;
else
cp = ch & 0x07;
++src;
if (((*src & 0xc0) != 0x80) && (cp <= 0x10ffff)) {
if (((src[i + 1] & 0xc0) != 0x80) && (cp <= 0x10ffff)) {
if (cp <= 255) {
dst = apr_psprintf(r->pool, "%s%c", dst, (unsigned char)cp);
dst[i] = (unsigned char) cp;
} else {
// no encoding possible
dst = apr_psprintf(r->pool, "%s%c", dst, '?');
dst[i] = '?';
}
}
i++;
}
dst[i] = '\0';
return dst;
}


/*
* set a HTTP header and/or environment variable to pass information to the application
*/
Expand Down

0 comments on commit 3bcda42

Please sign in to comment.