Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: headword parse modification #1704

Closed
wants to merge 12 commits into from
Closed

Conversation

xiaoyifang
Copy link
Owner

No description provided.

@@ -1733,27 +1739,27 @@ static void handleIdxSynFile( string const & fileName,
// punctuation folding. Hopefully there are not a whole lot of valid
// synonyms which really start from slash and contain dollar signs, or
// end with dollar and contain slashes.
if ( *word == '/' ) {
if ( strchr( word, '$' ) )
if ( headword.front() == '/' ) {
Copy link
Collaborator

@shenlebantongying shenlebantongying Jul 23, 2024

Choose a reason for hiding this comment

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

This and probably other lines may crash if wordLen = 0.

The wordLen comes from strlen(ptr) many lines before.

Maybe there should be an early break of this big for loop if wordLen = 0.

The next ptr of this big for loop is just ptr += wordLen + 1;.

For example, if the data file has two adjacent \0, what might happen in this region of code is questionable.

(I only skimmed this function briefly, so I don't know if this is really a case 😅)

Copy link
Owner Author

@xiaoyifang xiaoyifang Jul 23, 2024

Choose a reason for hiding this comment

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

for loop if wordLen = 0.

should be ok. this line used in parse the stardict dictionary.(Can not be sure)

Crash happens when doing the full-text indexing.

I happened to notice that crash has more great probability to occur when multiple stardict dictionaries in the full-text indexing process at the same time

Copy link
Owner Author

Choose a reason for hiding this comment

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

For example, if the data file has two adjacent \0, what might happen in this region of code is questionable.

If this happens ,it is really problemic.
Though We have to rely on the stardict format

@xiaoyifang xiaoyifang force-pushed the opt/stardict-headword branch from 476c71d to 1ff838c Compare July 23, 2024 07:11
@xiaoyifang xiaoyifang marked this pull request as draft July 24, 2024 01:39
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@xiaoyifang
Copy link
Owner Author

replaced by #1708

@xiaoyifang xiaoyifang closed this Jul 25, 2024
@xiaoyifang xiaoyifang deleted the opt/stardict-headword branch December 30, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants