libidn-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU libidn branch, master, updated. libidn-1-32-13-g1fbee57


From: Simon Josefsson
Subject: [SCM] GNU libidn branch, master, updated. libidn-1-32-13-g1fbee57
Date: Thu, 14 Jan 2016 13:33:02 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU libidn".

http://git.savannah.gnu.org/cgit/libidn.git/commit/?id=1fbee57ef3c72db2206dd87e4162108b2f425555

The branch, master has been updated
       via  1fbee57ef3c72db2206dd87e4162108b2f425555 (commit)
       via  11abd0e02c16f9e0b6944aea4ef0f2df44b42dd4 (commit)
      from  d4c533a5d975bf49090d3cd40acd230b8f79dd32 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1fbee57ef3c72db2206dd87e4162108b2f425555
Author: Simon Josefsson <address@hidden>
Date:   Thu Jan 14 14:31:33 2016 +0100

    stringprep_utf8_nfkc_normalize: Reject invalid UTF8 instead of crashing.
    
    Also add regression self check.  Reported by Hanno Böck.

commit 11abd0e02c16f9e0b6944aea4ef0f2df44b42dd4
Author: Simon Josefsson <address@hidden>
Date:   Thu Jan 14 14:09:29 2016 +0100

    Fix memory leak in last fix.

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                                 |    2 ++
 lib/idna.c                                 |    7 +++++--
 lib/nfkc.c                                 |   12 +++++++++++-
 tests/Makefile.am                          |    5 +++--
 tests/{tst_badutf8.c => tst_badutf8nfkc.c} |   23 +++++++----------------
 5 files changed, 28 insertions(+), 21 deletions(-)
 copy tests/{tst_badutf8.c => tst_badutf8nfkc.c} (64%)

diff --git a/.gitignore b/.gitignore
index ee53963..d207b3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -619,6 +619,8 @@ tests/Makefile.in
 tests/libutils.a
 tests/tst_badutf8
 tests/tst_badutf8.o
+tests/tst_badutf8nfkc
+tests/tst_badutf8nfkc.o
 tests/tst_idna
 tests/tst_idna.o
 tests/tst_idna2
diff --git a/lib/idna.c b/lib/idna.c
index 0ccd102..3ab1869 100644
--- a/lib/idna.c
+++ b/lib/idna.c
@@ -1,5 +1,5 @@
 /* idna.c --- Prototypes for Internationalized Domain Name library.
-   Copyright (C) 2002-2015 Simon Josefsson
+   Copyright (C) 2002-2016 Simon Josefsson
 
    This file is part of GNU Libidn.
 
@@ -213,7 +213,10 @@ step3:
     if (i < 64)
       out[i] = '\0';
     else
-      return IDNA_INVALID_LENGTH;
+      {
+       free (src);
+       return IDNA_INVALID_LENGTH;
+      }
     if (inasciirange)
       goto step8;
   }
diff --git a/lib/nfkc.c b/lib/nfkc.c
index 4992074..edc62c4 100644
--- a/lib/nfkc.c
+++ b/lib/nfkc.c
@@ -1,5 +1,5 @@
 /* nfkc.c --- Unicode normalization utilities.
-   Copyright (C) 2002-2015 Simon Josefsson
+   Copyright (C) 2002-2016 Simon Josefsson
 
    This file is part of GNU Libidn.
 
@@ -1086,6 +1086,16 @@ stringprep_ucs4_to_utf8 (const uint32_t * str, ssize_t 
len,
 char *
 stringprep_utf8_nfkc_normalize (const char *str, ssize_t len)
 {
+  size_t n;
+
+  if (len < 0)
+    n = strlen (str);
+  else
+    n = len;
+
+  if (u8_check ((const uint8_t *) str, n))
+    return NULL;
+
   return g_utf8_normalize (str, len, G_NORMALIZE_NFKC);
 }
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9130c32..5f4cb24 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,5 @@
 ## Process this file with automake to produce Makefile.in
-# Copyright (C) 2002-2015 Simon Josefsson
+# Copyright (C) 2002-2016 Simon Josefsson
 #
 # This file is part of GNU Libidn.
 #
@@ -27,7 +27,8 @@ libutils_a_SOURCES = utils.h utils.c
 
 ctests = tst_stringprep tst_punycode tst_idna tst_idna2 tst_idna3      \
        tst_idna4 tst_nfkc tst_pr29 tst_strerror tst_toutf8             \
-       tst_symbols tst_badutf8 tst_utf8crash tst_toascii64oob
+       tst_symbols tst_badutf8 tst_utf8crash tst_toascii64oob          \
+       tst_badutf8nfkc
 if TLD
 ctests += tst_tld
 endif
diff --git a/tests/tst_badutf8.c b/tests/tst_badutf8nfkc.c
similarity index 64%
copy from tests/tst_badutf8.c
copy to tests/tst_badutf8nfkc.c
index 2feb099..e67076b 100644
--- a/tests/tst_badutf8.c
+++ b/tests/tst_badutf8nfkc.c
@@ -1,5 +1,5 @@
-/* tst_badutf8.c --- Self tests for malformed UTF-8 regressions.
- * Copyright (C) 2015 Simon Josefsson
+/* tst_badutf8nfkc.c --- Self tests for malformed UTF-8 NFKC input.
+ * Copyright (C) 2016 Simon Josefsson
  *
  * This file is part of GNU Libidn.
  *
@@ -22,29 +22,20 @@
 # include "config.h"
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
 #include <string.h>
+#include <stdlib.h>
 
-#include <idna.h>
-#include <idn-free.h>
+#include <stringprep.h>
 
 #include "utils.h"
 
 void
 doit (void)
 {
-  char *badutf8 = strdup ("\x7e\x64\x61\x72\x10\x2f\x2f\xf9\x2b\x71"
-                         "\x60\x79\x7b\x2e\x63\x75\x2b\x61\x65\x72"
-                         "\x75\x65\x56\x66\x7f\x62\xc5\x76\xe5\x00");
+  char *badutf8 = strdup ("\xe4");
   char *s = NULL;
-  int rc;
 
-  rc = idna_to_ascii_8z (badutf8, &s, 0);
+  s = stringprep_utf8_nfkc_normalize (badutf8, -1);
+  free (s);
   free (badutf8);
-  if (rc != IDNA_ICONV_ERROR)
-    fail ("rc %d\n", rc);
-
-  idn_free (s);
 }


hooks/post-receive
-- 
GNU libidn



reply via email to

[Prev in Thread] Current Thread [Next in Thread]