GothenburgBitFactory / GothenburgBitFactory/taskwarrior
Out of bounds for CLI2::desugarFilterPlainArgs()
- Dominant language
- C++
- Stars
- 6.1k
- Forks
- 423
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 11
Description
* command run: task export (via a C program)
I ran the `task export` command from a C file using the execl command.
The following file is a minimal example to get this working on my machine:
```
#include
#include
int main() {
execl("/usr/bin/task", "export", NULL);
return 1;
}
```
When running this, I get the following output:
```
/usr/include/c++/13/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = A2; _Alloc = std::allocator; reference = A2&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)
```
After debugging, I found this happens because of the following call ` auto& penultimate = _args[_args.size () - 2]` inside ` CLI2::desugarFilterPlainArgs ()`, which causes a wrap-around because args.size() is only 1.
I run Fedora Linux 38 (Workstation Edition) x86_64 and have the following taskwarrior version: 2.6.2
If I am calling `task export` in the wrong manner, please let me know.
Contributor guide
Assessment
This issue has not been assessed yet.