Skip to content

Commit

Permalink
now fix assertions correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
picnixz committed Jan 5, 2025
1 parent 6b38769 commit 3ecba48
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,14 @@ ssl_error_lineno_width(int lineno)
FAST_PATH(5, 100000);
FAST_PATH(6, 1000000);
FAST_PATH(7, 10000000);
FAST_PATH(8, 100000000);
#undef FAST_PATH
return (size_t)ceil(log10(lineno));
/*
* log10() is imprecise above 10^14, but it's not a realistic case.
* Even with those imprecisions, we will overestimate the actual
* number of characters needed to render 'lineno'.
*/
return 1 + (size_t)log10(lineno);
}

/*
Expand Down

0 comments on commit 3ecba48

Please sign in to comment.