Comments (3)
That appears to be a message from ubsan, at the indicated line browser/complete.c:139:5
there is a call to memcpy, the first argument is allocated the line before using mutt_mem_realloc
. With the buffer being empty the size passed to mutt_mem_realloc
is 0, which results in memcpy
using a NULL pointer as the destination buffer, since the size passed to memcpy
is also 0 I don't believe particularly disastrous is likely to happen, but it is undefined behaviour to pass a NULL pointer to memcpy
.
I'm not entirely certain how this complete function is supposed to function, but I believe it would be relatively simple to add a simple check for the case of 0 length.
from neomutt.
Thanks for the bug report; I haven't had a chance to investigate yet.
As you've already noted, a simple check would stop the problem.
I'll certainly add something like that to the code before the next release.
However...
What I'd love to know is why we're getting a NULL
there.
If someone has a bit of time to dig into the code, it'd really be appreciated.
Feel free to ask lots of questions here, or on IRC: #neomutt
on irc.libera.chat
(web client)
Thanks!
from neomutt.
I can't seem reproduce this.
With ubsan enabled I actually get a different error on every completion, not just empty. Maybe because I'm on macOS.
editor/functions.c:187:12: runtime error: call to function complete_file_simple through pointer to incorrect function type 'enum FunctionRetval (*)(struct EnterWindowData *, int)'
complete.c:114: note: complete_file_simple defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior editor/functions.c:187:12
Which I can fix with:
diff --git a/browser/complete.c b/browser/complete.c
index f6dca66e1..673668a44 100644
--- a/browser/complete.c
+++ b/browser/complete.c
@@ -110,7 +110,7 @@ int complete_file_mbox(struct EnterWindowData *wdata, int op)
/**
* complete_file_simple - Complete a filename - Implements ::complete_function_t - @ingroup complete_api
*/
-int complete_file_simple(struct EnterWindowData *wdata, int op)
+enum FunctionRetval complete_file_simple(struct EnterWindowData *wdata, int op)
{
if (!wdata || ((op != OP_EDITOR_COMPLETE) && (op != OP_EDITOR_COMPLETE_QUERY)))
return FR_NO_ACTION;
from neomutt.
Related Issues (20)
- external filters in format strings are not called HOT 8
- Embedding CFLAGS makes neomutt unreproducible HOT 5
- Periodical crashing with segfault 11 on macOS 12.7.1. HOT 1
- Latest release hangs on startup (macOS 12.7.4) HOT 8
- Newline in attribution no longer properly handled HOT 2
- Compose Menu - top bar not updated after attaching files from file browser HOT 3
- Subject with non-printable characters or new line is shown with `?` HOT 30
- `Today` conditional date broken HOT 4
- Lag on half-down/half-up scrolling on macOS HOT 5
- Do we need to handle <stddef.h> specially? HOT 1
- conditional format strings broken in 2024-04-25 HOT 7
- Duplicate gpg keys in key selection menu for message encryption HOT 17
- segfault while opening a mailbox in from the sidebar HOT 2
- Doubts about paranoic defensive programming style HOT 3
- C dialect HOT 2
- tag-prefix doesn't work in attach HOT 5
- Doubts about some `*const` pointers HOT 5
- How to use the notmuch command <modify-labels> to tag emails with tags containing spaces?
- Is it possible to edit the automatic title when forwarding or replying a message? HOT 1
- Progress for postponing a message with remote (IMAP)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neomutt.