Conversation
Summary of ChangesHello @waruqi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily focuses on resolving issues with Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the tbox submodule to fix issues with tolower and toupper functions. However, a critical security vulnerability has been identified: the xm_string_lower function in core/src/xmake/string/lower.c contains a heap-based buffer overflow. This is due to an incorrect assumption that lowercased UTF-8 strings will always fit within the same byte length as the original, which is not universally true for Unicode characters. Additionally, a minor whitespace cleanup was performed in core/src/xmake/string/lower.c.
| // to lower | ||
| tb_long_t real_size = tb_charset_utf8_tolower(buffer, size); | ||
|
|
There was a problem hiding this comment.
The buffer buffer is allocated with size + 1 bytes (line 55), which is sufficient for ASCII but not for all UTF-8 characters. Some characters can increase in byte length when converted to lowercase (e.g., Ⱥ (U+023A, 2 bytes) becomes ⱥ (U+2C65, 3 bytes)). The call to tb_charset_utf8_tolower(buffer, size) on line 61 does not take a capacity argument and will write past the end of the buffer if the resulting string is longer than the input. This is a heap-based buffer overflow.
To fix this, allocate a larger buffer that can accommodate the maximum possible growth (e.g., size * 2 + 1) or use a dynamic buffer.
#7317