Skip to content

CPreProcessor: (bugfix) don't return negative value other than EOF from unget-buffer #4234

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

Merged

Conversation

masatake
Copy link
Member

Fix #4222.

This pull request consists of several commits.
They are redundant but descriptive.

The bug reported in #4222 was introduced in #4198.

…om unget-buffer

Fix universal-ctags#4222

When putting a char getting from the unget-buffer to a vstring,
returning a nagative value caused a crash.

This change focuses on values returned from
ungetBufferGetcFromUngetBuffer, a function for getting from the
unget-buffer.

I will revise the functions putting values to the
unget-buffer in the later commits.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
The original code focuses on the phase of getting a value from the
unget-buffer. As a fundamental fix, this change focuses on the phase
of putting values to the unget-buffer. Fixing the original bug at the
getting phase was just a workaround.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Copy link

codecov bot commented Apr 25, 2025

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.85%. Comparing base (e5b77bd) to head (5152f6e).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
parsers/cpreprocessor.c 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4234      +/-   ##
==========================================
+ Coverage   85.84%   85.85%   +0.01%     
==========================================
  Files         242      242              
  Lines       62608    62610       +2     
==========================================
+ Hits        53744    53752       +8     
+ Misses       8864     8858       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

We never store STRING_SYMBOL, CHAR_SYMBOL, and EOF to the
unget-buffer.

The original code was designed before I introduced
charOrStringContents. In the design, STRING_SYMBOL and CHAR_SYMBOL
could be stored to the unget-buffer.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake force-pushed the cpreprocessor--cast-unget-data branch from 4cba546 to 5152f6e Compare April 25, 2025 21:48
@masatake masatake merged commit 987f20d into universal-ctags:master Apr 26, 2025
89 of 91 checks passed
@masatake masatake mentioned this pull request Apr 26, 2025
4 tasks
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.

Java: crash with a multi-byte character
1 participant