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

aspell_speller_store_replacement returns "random" values #658

Open
frankheckenbach opened this issue Nov 28, 2024 · 0 comments
Open

aspell_speller_store_replacement returns "random" values #658

frankheckenbach opened this issue Nov 28, 2024 · 0 comments

Comments

@frankheckenbach
Copy link

Using aspell-0.60.8 on GNU/Linux amd64

I traced it to this:

lib/speller-c.cpp:
extern "C" int aspell_speller_store_replacement(...)
{
[...]
PosibErr ret = ths->store_replacement(...);
[...]
return ret.data;
}

modules/speller/default/speller_impl.hpp:
class SpellerImpl [...]
PosibErr store_replacement([...]);

common/posib_err.hpp:
template
class PosibErr : public PosibErrBase
{
PosibErr(const PosibErrBase & other)
: PosibErrBase(other) {}

PosibErr(const PosibErr<void> & other)
  : PosibErrBase(other) {}

Ret data;

};

static const PosibErr no_err;

So, both of these constructors (one of which is used in the implicit conversion of the result of SpellerImpl::store_replacement) leave data unset, and aspell_speller_store_replacement returns ret.data in case of success.

I don't know the supposed semantics, i.e. which function is at fault here, but initializing data should fix the problem:

PosibErr(const PosibErrBase & other)
  : PosibErrBase(other), data{} {}

PosibErr(const PosibErr<void> & other)
  : PosibErrBase(other), data{} {}

Though I wonder if these conversions make sense at all. PosibErr is about reliable error handling, but shouldn't it also ensure reliable result handling, not converting "void" to any type without even a warning?

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

No branches or pull requests

1 participant