From 7a81c58ae377f75c44fb235b9b73f47f33b9b1d9 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 18 Jul 2022 10:39:10 +0000 Subject: [PATCH] fixed a bug in hcl_feed() --- lib/read.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/read.c b/lib/read.c index 7fe0027..8a1b4f4 100644 --- a/lib/read.c +++ b/lib/read.c @@ -2952,9 +2952,10 @@ int hcl_feed (hcl_t* hcl, const hcl_ooch_t* data, hcl_oow_t len) { x = feed_char(hcl, data[i]); if (x <= -1) return -1; - i += x; + if (x > 0) { + /* consumed */ if (is_linebreak(data[i])) { hcl->c->feed.lx.loc.line++; @@ -2964,7 +2965,9 @@ int hcl_feed (hcl_t* hcl, const hcl_ooch_t* data, hcl_oow_t len) { hcl->c->feed.lx.loc.colm++; } + i += x; } + /* feed again if not consumed */ } } else