jgm / peg-markdown

An implementation of markdown in C, using a PEG grammar
Other
696 stars 140 forks source link

bad code block hangs peg-markdown #2

Closed isao closed 14 years ago

isao commented 14 years ago

I just made peg-markdown hang when, by mistake, I neglected to indent the initial curly brace in the following JSON code block. To reproduce, remove the two leading tabs on the line containing the first curly brace. Best regards --Isao

+begin tab-indented sample+

In this example, the bob's Memberships Collection now contains the newly created group:

    {
      "id":2,
      "username":"bob",
      "passhash":"401c30e3eb8693eb282d5a378e3edf11201933fc",
      "mobile_no":"14087591828",
      "email":"bob@mailinator.com",
      "carrier_id":"7",
      "is_verified":1,
      "is_active":1,
      "is_quiet":0,
      "quiet_start_time":0,
      "quiet_end_time":0,
      "created":1264015711,
      "updated":1264015711,
      "Memberships":{
        "2":{
          "group_id":2,
          "status":"joined",
          "is_active":1,
          "is_admin":1,
          "created":1264013960,
          "updated":1264013960,
          "name":"team_bobby",
          "description":"ricky bobby is a winner-- you on his team?",
          "is_public":0,
          "new_user_priv":"send-receive",
          "group_created":1264013960,
          "group_updated":1264013960
        },
        "4":{
          "group_id":4,
          "status":"joined",
          "is_active":1,
          "is_admin":0,
          "created":1264016105,
          "updated":1264016105,
          "name":"abcd",
          "description":"a group for you,
           if your name is in the first four letter of the alphabet",
          "is_public":1,
          "new_user_priv":"send-receive",
          "group_created":1264015827,
          "group_updated":1264015827
        },
        "5":{
          "group_id":5,
          "status":"joined",
          "is_active":1,
          "is_admin":1,
          "created":1266542158,
          "updated":1266542158,
          "name":"disabel",
          "description":"dis abel-- that jerk",
          "is_public":1,
          "new_user_priv":"send-receive",
          "group_created":1266542158,
          "group_updated":1266542158
        }
      }
    }

+end tab-indented sample+

jgm commented 14 years ago

Problem confirmed with input like this:

aaa_bbb_ccc_ddd_eee_fff aaa_bbb_ccc_ddd_eee_fff aaa_bbb_ccc_ddd_eee_fff aaa_bbb_ccc_ddd_eee_fff

Fixed in commit fda0bf49ff90319291524c927d79103b036eab8b

isao commented 14 years ago

wow, that was fast! thanks John