diff options
author | Taylor Venable <taylor@metasyntax.net> | 2011-02-01 18:52:10 -0500 |
---|---|---|
committer | Taylor Venable <taylor@metasyntax.net> | 2011-02-01 18:52:10 -0500 |
commit | 6ac05e50a77cc8ebcf335fd9d6908efc74e3e201 (patch) | |
tree | 803f8c409b192bb2491ccd28c983059c2a46b6a5 /lib | |
parent | 62dad961329a603110ce0e1d3f62554cc5228152 (diff) | |
download | otp-6ac05e50a77cc8ebcf335fd9d6908efc74e3e201.tar.gz otp-6ac05e50a77cc8ebcf335fd9d6908efc74e3e201.tar.bz2 otp-6ac05e50a77cc8ebcf335fd9d6908efc74e3e201.zip |
Fix infinite loop for malformed edoc input
When processing an edoc comment with ``` in it, if the comment ends
without a matching ''' then an infinite loop occurs in the function
edoc_wiki:strip_empty_lines/2. This change fixes that by adding a clause
to return from the function upon the end of the comment input. This
allows an error to be thrown to indicate the problem, which is the same
behaviour as leaving either `` or ` unmatched.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/edoc/src/edoc_wiki.erl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/edoc/src/edoc_wiki.erl b/lib/edoc/src/edoc_wiki.erl index e4a3d74734..6f269996c8 100644 --- a/lib/edoc/src/edoc_wiki.erl +++ b/lib/edoc/src/edoc_wiki.erl @@ -295,6 +295,8 @@ push_uri(Us, Ss, As) -> strip_empty_lines(Cs) -> strip_empty_lines(Cs, 0). +strip_empty_lines([], N) -> + {[], N}; % reached the end of input strip_empty_lines(Cs, N) -> {Cs1, Cs2} = edoc_lib:split_at(Cs, $\n), case edoc_lib:is_space(Cs1) of |