From 7503937d76df4c451a7899fc98f6d79b4f8d2496 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Tue, 8 Jul 2014 18:20:20 +0000 Subject: Fixed buggy FFFD (replacement character) in place of leading non-ascii character * closes:#48 --- src/htsencoding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/htsencoding.c b/src/htsencoding.c index 21d6cde..e6e0ff6 100644 --- a/src/htsencoding.c +++ b/src/htsencoding.c @@ -270,7 +270,7 @@ int hts_unescapeUrlSpecial(const char *src, char *dest, const size_t max, /* First character */ if (k == 0) { /* New destination-centric offset of utf-8 buffer beginning */ - if (i == lastI + 2) { /* just read a %xx */ + if (lastI != (size_t) -1 && i == lastI + 2) { /* just read a %xx */ utfBufferJ = lastJ; /* position of % */ } else { utfBufferJ = j; /* current position otherwise */ -- cgit v1.2.3