Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 28, 2025

Code for calculating the optimum quote character to use for StringLiterals could in theory produce arithmetic overflow (panic in debug mode, malfunction in release mode) if the string is very long and contains a very large number of quote characters e.g. "''''''''''''" (but much much longer).

Fix that by using i64 instead of i32 for the counter variables.

Copy link
Member Author

overlookmotel commented Mar 28, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-codegen Area - Code Generation C-bug Category - Bug labels Mar 28, 2025
@overlookmotel overlookmotel marked this pull request as ready for review March 28, 2025 10:34
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 28, 2025

CodSpeed Instrumentation Performance Report

Merging #10102 will not alter performance

Comparing 03-28-fix_codegen_prevent_arithmetic_overflow_calculating_quote_for_stringliteral_s (c903e42) with 03-27-perf_codegen_faster_printing_quotes (d190466)

Summary

✅ 33 untouched benchmarks

@overlookmotel overlookmotel force-pushed the 03-27-perf_codegen_faster_printing_quotes branch from 7bdf93b to 16b3916 Compare March 28, 2025 12:07
@overlookmotel overlookmotel force-pushed the 03-28-fix_codegen_prevent_arithmetic_overflow_calculating_quote_for_stringliteral_s branch 2 times, most recently from 92a03b8 to d3afce0 Compare March 28, 2025 12:59
@overlookmotel overlookmotel force-pushed the 03-27-perf_codegen_faster_printing_quotes branch from 16b3916 to 3511357 Compare March 28, 2025 12:59
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Mar 28, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Mar 29, 2025

Merge activity

…ngLiteral`s (#10102)

Code for calculating the optimum quote character to use for `StringLiteral`s could in theory produce arithmetic overflow (panic in debug mode, malfunction in release mode) if the string is very long and contains a very large number of quote characters e.g. `"''''''''''''"` (but much much longer).

Fix that by using `i64` instead of `i32` for the counter variables.
@graphite-app graphite-app bot force-pushed the 03-27-perf_codegen_faster_printing_quotes branch from 3511357 to d190466 Compare March 29, 2025 12:49
@graphite-app graphite-app bot force-pushed the 03-28-fix_codegen_prevent_arithmetic_overflow_calculating_quote_for_stringliteral_s branch from d3afce0 to c903e42 Compare March 29, 2025 12:50
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 29, 2025
Base automatically changed from 03-27-perf_codegen_faster_printing_quotes to main March 29, 2025 13:09
@graphite-app graphite-app bot merged commit c903e42 into main Mar 29, 2025
26 checks passed
@graphite-app graphite-app bot deleted the 03-28-fix_codegen_prevent_arithmetic_overflow_calculating_quote_for_stringliteral_s branch March 29, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants