osdldbt / dbt5

Database Test 5: Fair Use TPC Benchmark(TM) E
Artistic License 2.0
1 stars 10 forks source link

fix(bh): exception string being freed during throw #18

Closed ksyx closed 4 months ago

ksyx commented 4 months ago

The const char * thrown here is obtained from a std::string and is subject to being freed while the exception is being thrown.

It seems like all other exceptions thrown in the repo are of std::exception class, either from standard exception classes like std::runtime_error and std::range_error, or custom subclass C.*Error, that can be shown with

  grep -RHn 'throw ' src inc TestHarness/ \
  | grep -v 'C.*Err' | grep -v 'std::runtime_error'

Although given this fact, the exception thrown here is caught early at CBrokerageHouse::Run* methods, e.g. line 856 of BrokerageHouse.cpp simply logging a text saying TR EXCEPTION, and it might be making too much changes to apply for this simple improvement if consistency of exception class is demanded. https://github.com/osdldbt/dbt5/blob/5575431ad9826c532a466191239338c635002b0f/src/BrokerageHouse/BrokerageHouse.cpp#L856

markwkm commented 4 months ago

Merged. e1ce4a7ad7b9a38e9d5029570bb1209c2a7907fc