commonmarker 0.18.0 → 0.18.1

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: 11d4791ae4e26e529efbad366fef1bf1b0354caa
4
- data.tar.gz: 67dec1b64e22464e2b5fce687171ae338a80221f
3
+ metadata.gz: 489aa89b25b1a7719ed8e7eb90cee9407b41235f
4
+ data.tar.gz: 271d80841baf1d5945a9c8c8dac0b26e2e3f399d
5
5
  SHA512:
6
- metadata.gz: 77749bbebb465097693ce23e1436f38cdc9995389d3527b5e52fe0f1ef37cafd4438416c2d60ebf7863d4d3713f580244fd7f0aa8c3f718d9f7ebb5baf20630d
7
- data.tar.gz: 40ef8944199e42c68b7a61aa4d667778d555ad83502267b768e1d8c9424a8d9302e85ca68fe92c99b76fdf37d66afb05b093986792ed933973ac00a94bb20e0b
6
+ metadata.gz: f96e20323a729a2e4b59cd0c1bc7ce74c8620c21ded847695d15da281d73edfdea78049f750eb44eb45be946e8fa2e1d048e047c8ba81cda23d531e289e42b5f
7
+ data.tar.gz: 8e281208f058c1aa864210cbff8c61298c47a0786abc790b18c4f82dc05123bad1e34aad8ada94ea6e3401588f8e839db3f3546e2d3e90a01f24e24f34490a10
@@ -269,7 +269,11 @@ static cmark_node *match(cmark_syntax_extension *ext, cmark_parser *parser,
269
269
  // inline was finished in inlines.c.
270
270
  }
271
271
 
272
- static void postprocess_text(cmark_parser *parser, cmark_node *text, int offset) {
272
+ static void postprocess_text(cmark_parser *parser, cmark_node *text, int offset, int depth) {
273
+ // postprocess_text can recurse very deeply if there is a very long line of
274
+ // '@' only. Stop at a reasonable depth to ensure it cannot crash.
275
+ if (depth > 1000) return;
276
+
273
277
  size_t link_end;
274
278
  uint8_t *data = text->as.literal.data,
275
279
  *at;
@@ -307,7 +311,7 @@ static void postprocess_text(cmark_parser *parser, cmark_node *text, int offset)
307
311
  }
308
312
 
309
313
  if (rewind == 0 || ns > 0) {
310
- postprocess_text(parser, text, max_rewind + 1 + offset);
314
+ postprocess_text(parser, text, max_rewind + 1 + offset, depth + 1);
311
315
  return;
312
316
  }
313
317
 
@@ -327,14 +331,14 @@ static void postprocess_text(cmark_parser *parser, cmark_node *text, int offset)
327
331
 
328
332
  if (link_end < 2 || nb != 1 || np == 0 ||
329
333
  (!cmark_isalpha(data[link_end - 1]) && data[link_end - 1] != '.')) {
330
- postprocess_text(parser, text, max_rewind + 1 + offset);
334
+ postprocess_text(parser, text, max_rewind + 1 + offset, depth + 1);
331
335
  return;
332
336
  }
333
337
 
334
338
  link_end = autolink_delim(data, link_end);
335
339
 
336
340
  if (link_end == 0) {
337
- postprocess_text(parser, text, max_rewind + 1 + offset);
341
+ postprocess_text(parser, text, max_rewind + 1 + offset, depth + 1);
338
342
  return;
339
343
  }
340
344
 
@@ -369,7 +373,7 @@ static void postprocess_text(cmark_parser *parser, cmark_node *text, int offset)
369
373
  text->as.literal.len = offset + max_rewind - rewind;
370
374
  text->as.literal.data[text->as.literal.len] = 0;
371
375
 
372
- postprocess_text(parser, post, 0);
376
+ postprocess_text(parser, post, 0, depth + 1);
373
377
  }
374
378
 
375
379
  static cmark_node *postprocess(cmark_syntax_extension *ext, cmark_parser *parser, cmark_node *root) {
@@ -396,7 +400,7 @@ static cmark_node *postprocess(cmark_syntax_extension *ext, cmark_parser *parser
396
400
  }
397
401
 
398
402
  if (ev == CMARK_EVENT_ENTER && node->type == CMARK_NODE_TEXT) {
399
- postprocess_text(parser, node, 0);
403
+ postprocess_text(parser, node, 0, /*depth*/0);
400
404
  }
401
405
  }
402
406
 
@@ -1,7 +1,7 @@
1
1
  #ifndef CMARK_GFM_VERSION_H
2
2
  #define CMARK_GFM_VERSION_H
3
3
 
4
- #define CMARK_GFM_VERSION ((0 << 24) | (28 << 16) | (3 << 8) | 18)
5
- #define CMARK_GFM_VERSION_STRING "0.28.3.gfm.18"
4
+ #define CMARK_GFM_VERSION ((0 << 24) | (28 << 16) | (3 << 8) | 19)
5
+ #define CMARK_GFM_VERSION_STRING "0.28.3.gfm.19"
6
6
 
7
7
  #endif
@@ -1551,7 +1551,7 @@ int cmark_inline_parser_scan_delimiters(cmark_inline_parser *parser,
1551
1551
  }
1552
1552
  }
1553
1553
 
1554
- while (peek_char(parser) == c && numdelims <= max_delims) {
1554
+ while (peek_char(parser) == c && numdelims < max_delims) {
1555
1555
  numdelims++;
1556
1556
  advance(parser);
1557
1557
  }
@@ -191,6 +191,28 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node,
191
191
  case CMARK_NODE_IMAGE:
192
192
  break;
193
193
 
194
+ case CMARK_NODE_FOOTNOTE_REFERENCE:
195
+ if (entering) {
196
+ LIT("[^");
197
+ OUT(cmark_chunk_to_cstr(renderer->mem, &node->as.literal), false, LITERAL);
198
+ LIT("]");
199
+ }
200
+ break;
201
+
202
+ case CMARK_NODE_FOOTNOTE_DEFINITION:
203
+ if (entering) {
204
+ renderer->footnote_ix += 1;
205
+ LIT("[^");
206
+ char n[32];
207
+ snprintf(n, sizeof(n), "%d", renderer->footnote_ix);
208
+ OUT(n, false, LITERAL);
209
+ LIT("]: ");
210
+
211
+ cmark_strbuf_puts(renderer->prefix, " ");
212
+ } else {
213
+ cmark_strbuf_truncate(renderer->prefix, renderer->prefix->size - 4);
214
+ }
215
+ break;
194
216
  default:
195
217
  assert(false);
196
218
  break;
@@ -1,3 +1,3 @@
1
1
  module CommonMarker
2
- VERSION = '0.18.0'.freeze
2
+ VERSION = '0.18.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commonmarker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-17 00:00:00.000000000 Z
12
+ date: 2018-10-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-enum
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  version: '0'
244
244
  requirements: []
245
245
  rubyforge_project:
246
- rubygems_version: 2.5.2.3
246
+ rubygems_version: 2.5.1
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: CommonMark parser and renderer. Written in C, wrapped in Ruby.