Skip to content

qucsator crash calling std::polar #58

@GerryHickman

Description

@GerryHickman

When building c++ programs, major distros enable "lightweight" assertions _GLIBCXX_ASSERTIONS. This is to do with code hardening.

qucsator can crash if it calls std::polar with a negative magnitude.

qucs-lib has a library with op-amps; qucs/qucs-lib/library/OpAmps.lib
tl071(TI) has
CCCS:FB1 _net9 _net7 _net99 _cnet0 G="4.715e+06"
CCCS:FB2 _netP_VCC _net7 _net99 _cnet1 G="-5e+06"

note the negative 'G' here

net.cpp
dataset * net::runAnalysis (int &err) {

acsolver.cpp
int acsolver::solve (void) {
void acsolver::calc (acsolver * self) {
c->calcAC // calls virtual function

cccs.cpp
void cccs::calcAC (nr_double_t frequency) {
nr_double_t g = getPropertyDouble ("G");
nr_double_t t = getPropertyDouble ("T");
nr_complex_t r = qucs::polar (1.0 / g, - 2.0 * pi * frequency * t); // CRASH here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions