Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

fix a crash when parsing alert block syntax #593

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

devoncarew
Copy link
Contributor

@srawlins - this also revs the package version in preparation for publishing (so we can get the fix out for pub.dev).


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@devoncarew devoncarew requested a review from srawlins March 6, 2024 20:19
Copy link

github-actions bot commented Mar 6, 2024

Package publishing

Package Version Status Publish tag (post-merge)
package:markdown 7.2.2 ready to publish v7.2.2

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

@coveralls
Copy link

coveralls commented Mar 6, 2024

Pull Request Test Coverage Report for Build 8178324723

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.137%

Totals Coverage Status
Change from base Build 8086153533: 0.0%
Covered Lines: 1543
Relevant Lines: 1605

💛 - Coveralls

@@ -21,8 +21,7 @@ class AlertBlockSyntax extends BlockSyntax {

@override
bool canParse(BlockParser parser) {
return pattern.hasMatch(parser.current.content) &&
parser.lines.any((line) => _contentLineRegExp.hasMatch(line.content));
return alertPattern.hasMatch(parser.current.content);
Copy link
Contributor Author

@devoncarew devoncarew Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on #585 (comment) and https://github.com/dart-lang/markdown/issues/579 I removed the reference here to BlockParser.lines; I suspect it caused quadratic parsing times.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

Copy link
Collaborator

@srawlins srawlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix for the crash and performance issue. Thanks!

@@ -21,8 +21,7 @@ class AlertBlockSyntax extends BlockSyntax {

@override
bool canParse(BlockParser parser) {
return pattern.hasMatch(parser.current.content) &&
parser.lines.any((line) => _contentLineRegExp.hasMatch(line.content));
return alertPattern.hasMatch(parser.current.content);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@srawlins srawlins merged commit 1ca5166 into master Mar 7, 2024
8 checks passed
@srawlins srawlins deleted the fix_alert_syntax_parsing branch March 7, 2024 04:27
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Mar 7, 2024
…h, web, webdriver, webkit_inspection_protocol

Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/cec45fb..0de8aff):
  0de8aff3  2024-03-06  Sam Rawlins  Generate docs for enum static methods. (dart-lang/dartdoc#3697)
  9eafdc64  2024-03-06  Sam Rawlins  Rewrite Library.allOriginalModelElementNames. (dart-lang/dartdoc#3698)
  e8f36333  2024-03-06  Sam Rawlins  Fix SDK GitHub action with some stub headers and footers (dart-lang/dartdoc#3704)
  58c065d4  2024-03-05  Sam Rawlins  Bump snippets activated to 0.4.3 (dart-lang/dartdoc#3702)

http (https://github.com/dart-lang/http/compare/470d2c3..8d3c647):
  8d3c647  2024-03-06  Brian Quinlan  Add support for negotiating a subprotocol (dart-lang/http#1150)
  e71e739  2024-03-05  Brian Quinlan  Add `WebSocket.connect` as a cross-platform connection method (dart-lang/http#1149)
  f14b5aa  2024-03-04  Brian Quinlan  Include a description and version number in web_socket pubspec (dart-lang/http#1148)
  5b656a9  2024-03-04  Brian Quinlan  Add a LICENSE file to package:web_socket (dart-lang/http#1147)
  557c420  2024-03-04  Brian Quinlan  Implement WebSocket for the browser (dart-lang/http#1142)

markdown (https://github.com/dart-lang/markdown/compare/dd47c5d..1ca5166):
  1ca5166  2024-03-06  Devon Carew  fix a crash when parsing alert block syntax (dart-archive/markdown#593)

package_config (https://github.com/dart-lang/package_config/compare/4a7042b..3d90e69):
  3d90e69  2024-03-05  Michael Thomsen  Fix typo (dart-archive/package_config#149)

shelf (https://github.com/dart-lang/shelf/compare/da6a69b..1acbc67):
  1acbc67  2024-03-06  Andy  Add shelf_router middleware examples (dart-lang/shelf#417)

vector_math (https://github.com/google/vector_math.dart/compare/3706feb..7e705f7):
  7e705f7  2024-03-06  6y  Fix quaternion negate (google/vector_math.dart#316)
  1ed8ac6  2024-03-06  6y  Resolve Inconsistency in Matrix3 and Matrix4 `rotateY` Implementations (google/vector_math.dart#317)

web (https://github.com/dart-lang/web/compare/8870d04..51e594b):
  51e594b  2024-03-05  Srujan Gaddam  Fix dictionary constructors to accept supertype members and create an empty object when there are no fields (dart-lang/web#197)
  4af904f  2024-03-05  Srujan Gaddam  Publish 0.5.1 (dart-lang/web#196)
  c72ec1a  2024-03-04  Devon Carew  add instructions for re-generating the package (dart-lang/web#195)

webdriver (https://github.com/google/webdriver.dart/compare/2c1b6f8..73a7ac8):
  73a7ac8  2024-03-04  dependabot[bot]  Bump nanasess/setup-chromedriver from 2.2.1 to 2.2.2 (google/webdriver.dart#294)

webkit_inspection_protocol (https://github.com/google/webkit_inspection_protocol.dart/compare/07295b9..153fea4):
  153fea4  2024-03-04  dependabot[bot]  Bump nanasess/setup-chromedriver (google/webkit_inspection_protocol.dart#120)

Change-Id: Ic213677a1e2430a6de56a94e0bfaa1f33e2fc7d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356300
Auto-Submit: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
mosuem pushed a commit to dart-lang/tools that referenced this pull request Dec 9, 2024
* fix a crash when parsing alert block syntax

* update version.dart

* Remove the reference to 'parser.lines' in canParse().
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants