summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-07-08 18:20:20 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-07-08 18:20:20 +0000
commit7503937d76df4c451a7899fc98f6d79b4f8d2496 (patch)
tree516960bd2fc051f8826fb1224f51863007505e77
parent23fa293e9e91c286d88288f7aa33f90649b92454 (diff)
Fixed buggy FFFD (replacement character) in place of leading non-ascii character
* closes:#48
-rw-r--r--src/htsencoding.c2
1 files changed, 1 insertions, 1 deletions
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 */