From 86e099c1342c90d308037d1a72515697e85f1106 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 27 Feb 2019 10:13:18 +0000 Subject: gbase64: Convert a precondition from g_error() to g_return_val_if_fail() The caller needs to check this themselves in any case, so we might as well at least follow convention in defining the precondition. Signed-off-by: Philip Withnall --- glib/gbase64.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'glib/gbase64.c') diff --git a/glib/gbase64.c b/glib/gbase64.c index ae9d5fef5..d3416e310 100644 --- a/glib/gbase64.c +++ b/glib/gbase64.c @@ -268,9 +268,7 @@ g_base64_encode (const guchar *data, /* We can use a smaller limit here, since we know the saved state is 0, +1 is needed for trailing \0, also check for unlikely integer overflow */ - if (len >= ((G_MAXSIZE - 1) / 4 - 1) * 3) - g_error("%s: input too large for Base64 encoding (%"G_GSIZE_FORMAT" chars)", - G_STRLOC, len); + g_return_val_if_fail (len < ((G_MAXSIZE - 1) / 4 - 1) * 3, NULL); out = g_malloc ((len / 3 + 1) * 4 + 1); -- cgit v1.2.1