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

Fix heap corruption from wmode out-of-bound writes on windows #6272

Merged
merged 1 commit into from Mar 24, 2024

Conversation

TheFlipbook
Copy link
Contributor

  • would throw error on VS2022 on GGML_FREE(wmode)
  • wchar_t is usually 2 bytes, but malloc wants bytes
    • therefore *wmode_p++ = (wchar_t)*mode; could write off the end of the allocation
  • Fixes error possibly introduced by use _wfopen instead of fopen on Windows #6248

* would throw error on VS2022 on GGML_FREE(wmode)
* wchar_t is usually 2 bytes, but malloc wants bytes
  * therefore `*wmode_p++ = (wchar_t)*mode;` could write off the end of the allocation
* Fixes error possibly introduced by ggerganov#6248
@dranger003
Copy link
Contributor

dranger003 commented Mar 24, 2024

I also get this issue running on Windows, and confirm this fix resolves the issue.

@slaren slaren merged commit a32b77c into ggerganov:master Mar 24, 2024
56 checks passed
cebtenzzre pushed a commit to nomic-ai/llama.cpp that referenced this pull request Mar 25, 2024
…nov#6272)

* would throw error on VS2022 on GGML_FREE(wmode)
* wchar_t is usually 2 bytes, but malloc wants bytes
  * therefore `*wmode_p++ = (wchar_t)*mode;` could write off the end of the allocation
* Fixes error possibly introduced by ggerganov#6248

(cherry picked from commit a32b77c)
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
…nov#6272)

* would throw error on VS2022 on GGML_FREE(wmode)
* wchar_t is usually 2 bytes, but malloc wants bytes
  * therefore `*wmode_p++ = (wchar_t)*mode;` could write off the end of the allocation
* Fixes error possibly introduced by ggerganov#6248
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 3, 2024
…nov#6272)

* would throw error on VS2022 on GGML_FREE(wmode)
* wchar_t is usually 2 bytes, but malloc wants bytes
  * therefore `*wmode_p++ = (wchar_t)*mode;` could write off the end of the allocation
* Fixes error possibly introduced by ggerganov#6248
tybalex pushed a commit to tybalex/function.cpp that referenced this pull request Apr 17, 2024
…nov#6272)

* would throw error on VS2022 on GGML_FREE(wmode)
* wchar_t is usually 2 bytes, but malloc wants bytes
  * therefore `*wmode_p++ = (wchar_t)*mode;` could write off the end of the allocation
* Fixes error possibly introduced by ggerganov#6248
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.

None yet

3 participants