commonmarker 0.14.5 → 0.14.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of commonmarker might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2464d1ed429720b63b234bbd8a57114c18c0f80f
4
- data.tar.gz: 9f58b78d8a6e2262da5a78948ef73da2d55722fb
3
+ metadata.gz: df1ca727051898c396602b8ce332cd3c6c232d50
4
+ data.tar.gz: 24e3981cd9181b6321e9f900fb0a276bad473555
5
5
  SHA512:
6
- metadata.gz: ebafa228760dfd38353a459726f4090638f1e007a7e80c29f45548a2fed122379a5ba6c7b3900e98885248725dd23a6daec2c5ef7e09c11f80335c9e81b69ce3
7
- data.tar.gz: 862331cc8c3b5d90566e07dcf4b2fc572c60d36a8a5d4078517256fed201d2988d4c27df08f5662d509bbe3914c3f5ac6bf8c14f7fc46e013424f8539199a390
6
+ metadata.gz: ec9202cfb38549225b29ba5818fb9807cce64cbfaa7510786d35628dcada26c8afda18bf1b72c3908afbe5cb39b534a4e525110b31c046094b5d68d28a949a97
7
+ data.tar.gz: 59ed7f0ad60a07c50f6cafbd75456980760f1743418a227ea748e86e827ec69f68d6f59f8ef82142e8cbe22a395d84700a77df948539a4c5fda196e6459d737c
@@ -1,6 +1,7 @@
1
1
  #include "autolink.h"
2
2
  #include <parser.h>
3
3
  #include <string.h>
4
+ #include <utf8.h>
4
5
 
5
6
  #if defined(_WIN32)
6
7
  #define strncasecmp _strnicmp
@@ -8,6 +9,14 @@
8
9
  #include <strings.h>
9
10
  #endif
10
11
 
12
+ static int is_valid_hostchar(const uint8_t *link, size_t link_len) {
13
+ int32_t ch;
14
+ int r = cmark_utf8proc_iterate(link, (bufsize_t)link_len, &ch);
15
+ if (r < 0)
16
+ return 0;
17
+ return !cmark_utf8proc_is_space(ch) && !cmark_utf8proc_is_punctuation(ch);
18
+ }
19
+
11
20
  static int sd_autolink_issafe(const uint8_t *link, size_t link_len) {
12
21
  static const size_t valid_uris_count = 3;
13
22
  static const char *valid_uris[] = {"http://", "https://", "ftp://"};
@@ -18,7 +27,7 @@ static int sd_autolink_issafe(const uint8_t *link, size_t link_len) {
18
27
  size_t len = strlen(valid_uris[i]);
19
28
 
20
29
  if (link_len > len && strncasecmp((char *)link, valid_uris[i], len) == 0 &&
21
- cmark_isalnum(link[len]))
30
+ is_valid_hostchar(link + len, link_len - len))
22
31
  return 1;
23
32
  }
24
33
 
@@ -114,7 +123,7 @@ static size_t check_domain(uint8_t *data, size_t size, int allow_short) {
114
123
  uscore1 = uscore2;
115
124
  uscore2 = 0;
116
125
  np++;
117
- } else if (!cmark_isalnum(data[i]) && data[i] != '-')
126
+ } else if (!is_valid_hostchar(data + i, size - i) && data[i] != '-')
118
127
  break;
119
128
  }
120
129
 
@@ -8,13 +8,24 @@
8
8
  extern "C" {
9
9
  #endif
10
10
 
11
+ CMARK_EXPORT
11
12
  void cmark_utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str,
12
13
  bufsize_t len);
14
+
15
+ CMARK_EXPORT
13
16
  void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf);
17
+
18
+ CMARK_EXPORT
14
19
  int cmark_utf8proc_iterate(const uint8_t *str, bufsize_t str_len, int32_t *dst);
20
+
21
+ CMARK_EXPORT
15
22
  void cmark_utf8proc_check(cmark_strbuf *dest, const uint8_t *line,
16
23
  bufsize_t size);
24
+
25
+ CMARK_EXPORT
17
26
  int cmark_utf8proc_is_space(int32_t uc);
27
+
28
+ CMARK_EXPORT
18
29
  int cmark_utf8proc_is_punctuation(int32_t uc);
19
30
 
20
31
  #ifdef __cplusplus
@@ -431,6 +431,8 @@ a.w@b.c
431
431
  Full stop outside parens shouldn't be included http://google.com/ok.
432
432
 
433
433
  (Full stop inside parens shouldn't be included http://google.com/ok.)
434
+
435
+ http://🍄.ga/ http://x🍄.ga/
434
436
  .
435
437
  <p>: <a href="http://google.com">http://google.com</a> <a href="https://google.com">https://google.com</a></p>
436
438
  <p><a href="http://google.com/%C3%A5">http://google.com/å</a> <a href="http://google.com/%C3%A5">http://google.com/å</a></p>
@@ -442,6 +444,7 @@ Full stop outside parens shouldn't be included http://google.com/ok.
442
444
  <p><a href="mailto:a.w@b.c">a.w@b.c</a></p>
443
445
  <p>Full stop outside parens shouldn't be included <a href="http://google.com/ok">http://google.com/ok</a>.</p>
444
446
  <p>(Full stop inside parens shouldn't be included <a href="http://google.com/ok">http://google.com/ok</a>.)</p>
447
+ <p><a href="http://%F0%9F%8D%84.ga/">http://🍄.ga/</a> <a href="http://x%F0%9F%8D%84.ga/">http://x🍄.ga/</a></p>
445
448
  ````````````````````````````````
446
449
 
447
450
  ```````````````````````````````` example
@@ -1,3 +1,3 @@
1
1
  module CommonMarker
2
- VERSION = '0.14.5'.freeze
2
+ VERSION = '0.14.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmarker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.5
4
+ version: 0.14.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-06 00:00:00.000000000 Z
11
+ date: 2017-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-enum