Fossil

Check-in [cd5e9f26]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Additional efforts to limit depth of recursion in markdown.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cd5e9f265de1a0d57fcdab55ee2a8c96823e11eb20142d67164fdc9ed7810581
User & Date: drh 2019-09-24 18:16:26.835
Context
2019-09-24
19:52
Use the strcspn() C-library routine to optimize the textLength() function in the Fossil-wiki formatter. ... (check-in: 64a63468 user: drh tags: trunk)
18:16
Additional efforts to limit depth of recursion in markdown. ... (check-in: cd5e9f26 user: drh tags: trunk)
18:04
Attempt to limit the depth of recursion in markdown formatting. ... (check-in: a5835cac user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/markdown.c.
430
431
432
433
434
435
436




437
438
439
440
441
442
443
  char *data,
  size_t size
){
  size_t i = 0, end = 0;
  char_trigger action = 0;
  struct Blob work = BLOB_INITIALIZER;





  while( i<size ){
    /* copying inactive chars into the output */
    while( end<size
     && (action = rndr->active_char[(unsigned char)data[end]])==0
    ){
      end++;
    }







>
>
>
>







430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
  char *data,
  size_t size
){
  size_t i = 0, end = 0;
  char_trigger action = 0;
  struct Blob work = BLOB_INITIALIZER;

  if( too_deep(rndr) ){
    blob_append(ob, data, size);
    return;
  }
  while( i<size ){
    /* copying inactive chars into the output */
    while( end<size
     && (action = rndr->active_char[(unsigned char)data[end]])==0
    ){
      end++;
    }
1303
1304
1305
1306
1307
1308
1309

1310



1311
1312
1313
1314
1315
1316
1317
      }
      work_size += end-beg;
    }
    beg = end;
  }

  if( rndr->make.blockquote ){

    parse_block(out, rndr, work_data, work_size);



    rndr->make.blockquote(ob, out, rndr->make.opaque);
  }
  release_work_buffer(rndr, out);
  return end;
}









>
|
>
>
>







1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
      }
      work_size += end-beg;
    }
    beg = end;
  }

  if( rndr->make.blockquote ){
    if( !too_deep(rndr) ){
      parse_block(out, rndr, work_data, work_size);
    }else{
      blob_append(out, work_data, work_size);
    }
    rndr->make.blockquote(ob, out, rndr->make.opaque);
  }
  release_work_buffer(rndr, out);
  return end;
}