diff options
author | Nobuyoshi Nakada <[email protected]> | 2021-03-18 18:48:56 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-03-19 07:15:55 +0900 |
commit | f748b911c9157a0bb86f38280ddfba72a55049b6 () | |
tree | 0ce6ff2071b3708ca52401bcdc56c4ea13effb32 /eval_intern.h | |
parent | cc281bd7ace7538527eea98a326d79c91ff48fad (diff) |
Fix infinite loop at illegal sequence [Bug #17729]
As mblen returns -1 on failure, skip the first byte and try the succeeding bytes in that case. Close https://.com/ruby/ruby/pull/4281
Notes: Merged: https://.com/ruby/ruby/pull/4284
-rw-r--r-- | eval_intern.h | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -302,7 +302,16 @@ VALUE rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, l #ifndef CharNext /* defined as CharNext[AW] on Windows. */ # ifdef HAVE_MBLEN -# define CharNext(p) ((p) + mblen((p), RUBY_MBCHAR_MAXSIZE)) # else # define CharNext(p) ((p) + 1) # endif |