Version in base suite: 3.3.114-2 Base version: gtkwave_3.3.114-2 Target version: gtkwave_3.3.118-0.1~deb12u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/g/gtkwave/gtkwave_3.3.114-2.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/g/gtkwave/gtkwave_3.3.118-0.1~deb12u1.dsc ChangeLog | 56 LICENSE.TXT | 2 Makefile.in | 4 README | 192 -- README.md | 145 ++ configure | 20 configure.ac | 2 contrib/bundle_for_osx/Info-gtkwave.plist | 6 contrib/vpi/Makefile.am | 30 contrib/vpi/acc_user.h | 568 ++++++++ contrib/vpi/sys_fst.c | 816 ++++++++++++ contrib/vpi/vpi_user.h | 807 +++++++++++ contrib/xml2stems/xml2stems.cc | 20 debian/changelog | 55 debian/patches/0001-Add-F-to-exec-key-in-desktop-file.patch | 6 debian/patches/autotools-pkg-config.diff | 26 debian/patches/series | 1 debian/upstream/metadata | 1 debian/watch | 2 distro_from_svn.sh | 10 man/vcd2fst.1 | 2 share/appdata/Makefile.am | 2 share/appdata/Makefile.in | 2 share/appdata/gtkwave.appdata.xml | 20 share/appdata/io.github.gtkwave.GTKWave.metainfo.xml | 143 ++ src/debug.c | 39 src/debug.h | 3 src/extload.c | 6 src/globals.c | 2 src/globals.h | 2 src/gtk23compat.h | 2 src/helpers/evcd2vcd.c | 14 src/helpers/fst/fstapi.c | 329 +++- src/helpers/lxt2_read.c | 96 + src/helpers/vcd2fst.c | 47 src/helpers/vcd2lxt.c | 69 - src/helpers/vcd2lxt2.c | 69 - src/helpers/vcd2vzt.c | 69 - src/helpers/vzt_read.c | 141 +- src/helpers/vzt_write.c | 8 src/libghw.c | 3 src/liblzma/LzmaLib.c | 37 src/main.c | 4 src/menu.c | 3 src/ptranslate.c | 2 src/savefile.c | 4 src/ttranslate.c | 2 src/twinwave.c | 2 src/vcd.c | 17 src/vcd_partial.c | 17 src/vcd_recoder.c | 15 51 files changed, 3543 insertions(+), 397 deletions(-) diff -Nru gtkwave-3.3.114/ChangeLog gtkwave-3.3.118/ChangeLog --- gtkwave-3.3.114/ChangeLog 2022-11-23 05:56:01.000000000 +0000 +++ gtkwave-3.3.118/ChangeLog 2023-12-31 21:11:04.000000000 +0000 @@ -1831,3 +1831,59 @@ 3.3.113 04oct22 Bugfix-only release. High CPU utilization when nothing is happening. 3.3.114 23nov22 Buffer overflow fixes in FST reader. +3.3.115 28mar23 Fix VZT reader with -fstrict-aliasing. + Fix use_multi_state condition in vzt_write.c. + Fix for UNDEF vs strings at start of a vzt file. + Fix sleep() time scaling redefine for mingw. + Use MapViewOfFileEx for mmap on Windows (fstapi). + Define FST_DO_MISALIGNED_OPS on AArch64 (fstapi). + Fixed attrbegin short length problem. +3.3.116 25jun23 Fix manpage/odt for vcd2fst command switch documentation for + zlibpack. + Add GDK_WINDOWING_WAYLAND check for gdkwayland.h header usage. + Changed sprintf to snprintf in fstapi.c. + Fix init crash on show_base_symbols enabled. +3.3.117 08aug23 Fix stems reader processing code broken in 3.3.114. +3.3.118 17dec23 Update xml2stems to handle newer "loc" vs "fl" xml tags. + Change preg_regex_c_1 decl to use regex_t* as datatype. + Move gtkwave.appdata.xml to + io.github.gtkwave.GTKWave.metainfo.xml. + Fixed popen security advisories: + TALOS-2023-1786 + Fixed FST security advisories: + TALOS-2023-1777 + TALOS-2023-1783 + TALOS-2023-1785 + TALOS-2023-1789 + TALOS-2023-1790 + TALOS-2023-1791 + TALOS-2023-1792 + TALOS-2023-1793 + TALOS-2023-1797 + TALOS-2023-1798 + Fixed evcd2vcd security advisories: + TALOS-2023-1803 + Fixed VCD security advisories: + TALOS-2023-1804 + TALOS-2023-1805 + TALOS-2023-1806 + TALOS-2023-1807 + Fixed VZT security advisories: + TALOS-2023-1810 + TALOS-2023-1811 + TALOS-2023-1812 + TALOS-2023-1813 + TALOS-2023-1814 + TALOS-2023-1815 + TALOS-2023-1816 + TALOS-2023-1817 + Fixed LXT2 security advisories: + TALOS-2023-1818 + TALOS-2023-1819 + TALOS-2023-1820 + TALOS-2023-1821 + TALOS-2023-1822 + TALOS-2023-1823 + TALOS-2023-1824 + TALOS-2023-1826 + TALOS-2023-1827 diff -Nru gtkwave-3.3.114/LICENSE.TXT gtkwave-3.3.118/LICENSE.TXT --- gtkwave-3.3.114/LICENSE.TXT 2022-11-23 05:56:24.000000000 +0000 +++ gtkwave-3.3.118/LICENSE.TXT 2023-12-31 21:11:03.000000000 +0000 @@ -1,6 +1,6 @@ ########################################################################## -GTKWave 3.3.113 Wave Viewer is Copyright (C) 1999-2023 Tony Bybell. +GTKWave 3.3.118 Wave Viewer is Copyright (C) 1999-2023 Tony Bybell. Portions of GTKWave are Copyright (C) 1999-2023 Udi Finkelstein. Context support is Copyright (C) 2007-2023 Kermin Elliott Fleming. Trace group support is Copyright (C) 2009-2023 Donald Baltus. diff -Nru gtkwave-3.3.114/Makefile.in gtkwave-3.3.118/Makefile.in --- gtkwave-3.3.114/Makefile.in 2022-11-23 05:57:59.000000000 +0000 +++ gtkwave-3.3.118/Makefile.in 2023-12-31 21:11:03.000000000 +0000 @@ -79,8 +79,8 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/config.h.in AUTHORS COPYING ChangeLog INSTALL NEWS \ - README compile config.guess config.sub depcomp install-sh \ - missing ylwrap + compile config.guess config.sub depcomp install-sh missing \ + ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ diff -Nru gtkwave-3.3.114/README gtkwave-3.3.118/README --- gtkwave-3.3.114/README 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,192 +0,0 @@ -1) Type ./configure -2) make -3) make install (as root) - -Make sure you copy the .gtkwaverc file to your home directory or to your -VCD project directory. It contains the prefs for a good configuration -that most people find ergonomic. It is not strictly necessary however. - -[Note: for mingw builds with gtk+-1, you might need a fake gtk-config file like -the following..] - -<> -#!/bin/sh - -if [ "$1" == "--libs" ] - then - echo -L/home/bybell/libs -lgck -lgdk-1.3 -lgimp-1.2 -lgimpi -lgimpui-1.2 -lglib-1.3 -lgmodule-1.3 -lgnu-intl -lgobject-1.3 -lgthread-1.3 -lgtk-1.3 -liconv-1.3 -ljpeg -llibgplugin_a -llibgplugin_b -lpng -lpthread32 -ltiff-lzw -ltiff-nolzw -ltiff - fi - -if [ "$1" == "--cflags" ] - then - echo " -mms-bitfields -I/home/bybell/src/glib -I/home/bybell/src/gtk+/gtk -I/home/bybell/src/gtk+/gdk -I/home/bybell/src/gtk+ " - fi -<> - -[Note2: for mingw with gtk+-2, you don't need to do anything except have -pkg-config in your PATH however the following note is from Thomas Uhle.] - -Important to know is to compile with CFLAGS=-mms-bitfields in Windows in order to link correctly -to the GTK+ dlls. This is how I did configure GTKWave with additional optimisation switches: - -./configure CFLAGS='-Wall -O3 -mcpu=i686 -mms-bitfields -ffast-math -fstrict-aliasing' - -After that you may just call make the usual way. - - - -Note that Ver Structural Verilog Compiler AET files are no longer supported. -They have been superceded by LXT. Also note that the AMULET group will be -taking over maintenance of the viewer effective immediately. - --251201ajb bybell@nc.rr.com - - -AMULET has ceased development of the 2.x branch of the viewer. 1.3 -apparently is the only active version currently. - --150405ajb bybell@nc.rr.com - - -The 1.3 series has been promoted to 3.x in order to prevent confusion over -what version of the viewer is the latest. Starting with 3.x, the viewer -supports source code annotation. - --030406ajb bybell@nc.rr.com - - -Add these flags to your compile for new warnings on AMD64: --g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic - -on i386: --g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables - --150407ajb - - -For cvs access to the experimental, pre-release sourcetree on Sourceforge: -cvs -d:pserver:anonymous@gtkwave.cvs.sourceforge.net:/cvsroot/gtkwave login -[press enter] -cvs -z3 -d:pserver:anonymous@gtkwave.cvs.sourceforge.net:/cvsroot/gtkwave co -P gtkwave3 - --191208ajb bybell@nc.rr.com - - -CVS is no longer being updated, for SVN access: -svn co https://gtkwave.svn.sourceforge.net/svnroot/gtkwave gtkwave - --310511ajb - -=============================================================================== - -Note (1) For Ubuntu users: - -I had to do the following to get it to install directly. Please -include in INSTALL .txt as an option for ubuntu users. Other linux -distributions might have other things to do. - -sudo apt-get install libgtk2.0-dev -./configure --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4 - --030109ajb bybell@nc.rr.com - - -Note (2) For Ubuntu users: - -If your compile fails because gzopen64 cannot be found, you will either have -to fix your Ubuntu install or use the version of libz in gtkwave: - -./configure --enable-local-libz - --140409ajb bybell@nc.rr.com - -Note (3) For Ubuntu users (version 11.10): - -sudo apt-get install libjudy-dev -sudo apt-get install libbz2-dev -sudo apt-get install liblzma-dev -sudo apt-get install libgconf2-dev -sudo apt-get install libgtk2.0-dev -sudo apt-get install tcl-dev -sudo apt-get install tk-dev -sudo apt-get install gperf -sudo apt-get install gtk2-engines-pixbuf - -Configure then as: - -./configure --enable-judy --enable-struct-pack --with-gconf - --010212ajb bybell@nc.rr.com - -=============================================================================== - -Notes for Mac OSX users: - -Install MacPorts then - -sudo port -v selfupdate -sudo port install Judy tcl tk xz-devel gtk2 - -If Quartz is used: -sudo port install gtk-osx-application - -./configure --prefix=/opt/local --enable-judy --enable-struct-pack "CFLAGS=-I/opt/local/include -O2 -g" LDFLAGS=-L/opt/local/lib --no-create --no-recursion - -Tcl works in the OSX version of gtkwave starting with version 3.3.26. - -At this point all features working on Linux should be functional on the Mac, -except that twinwave does not render to a single window when Quartz is used -instead of X11. - -If you wish to use llvm, also add "CC=llvm-gcc" and change the "-O2" in CFLAGS -to "-O4". - -At the current time Quartz support is experimental. Please report any bugs -encountered as compared to X11 function. - -=== - -Note that the preferred environment for Quartz builds is jhbuild. To build -gtkwave as an app bundle (while in jhbuild shell): - -./configure --enable-judy --enable-struct-pack --prefix=/Users/$USER/gtk/inst -make -make install -cd contrib/bundle_for_osx -./make_bundle.sh - -This assumes that Judy arrays and XZ were both already compiled and installed. -If Judy arrays are not installed, do not add --enable-judy. -If XZ is not installed, add --disable-xz. - -The current environment used is modulesets. Bug 664894 has an interim fix in -the binary distribution by applying patches using the -contrib/bundle_for_osx/gtk_diff_against_modulesets.patch file. - --311211ajb bybell@nc.rr.com - -=============================================================================== - -MSYS2 notes for creating a working environment for compiling gtkwave: - -pacman -Syuu -[repeat "pacman -Syuu" multiple times until environment stabilizes] -pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git subversion mercurial mingw-w64-i686-cmake mingw-w64-x86_64-cmake -pacman -S base-devel mingw-w64-toolchain mingw-w64-i686-gtk2 -pacman -S mingw-w64-i686-gtk2 -pacman -S mingw-w64-x86_64-gtk2 -pacman -S mingw-w64-i686-gtk3 -pacman -S mingw-w64-x86_64-gtk3 - --121217ajb bybell@rocketmail.com - -=============================================================================== - -Add --enable-gtk3 to the ./configure invocation to build against GTK3. - - --enable-gtk3 Causes the GTK+ frontend to be built with gtk3 - instead of gtk2. - --150718ajb bybell@rocketmail.com - -=============================================================================== diff -Nru gtkwave-3.3.114/README.md gtkwave-3.3.118/README.md --- gtkwave-3.3.114/README.md 1970-01-01 00:00:00.000000000 +0000 +++ gtkwave-3.3.118/README.md 2023-12-31 21:11:03.000000000 +0000 @@ -0,0 +1,145 @@ +# GTKWave + +## Installation + +2) If you compile a GIT version: Type `./autogen.sh` +2) Type `./configure --enable-gtk3` (or `./configure` for GTK+ 2) +3) `make` +4) `make install` (as root) + +Make sure you copy the `.gtkwaverc` file to your home directory or to your +VCD project directory. It contains the prefs for a good configuration +that most people find ergonomic. It is not strictly necessary however. + +[Note: for mingw with gtk+-2, you don't need to do anything except have +pkg-config in your PATH however the following note is from Thomas Uhle.] + +Important to know is to compile with `CFLAGS=-mms-bitfields` in Windows in order to link correctly +to the GTK+ dlls. This is how I did configure GTKWave with additional optimisation switches: + +```sh +./configure CFLAGS='-Wall -O3 -mcpu=i686 -mms-bitfields -ffast-math -fstrict-aliasing' +``` + +After that you may just call make the usual way. + +## Misc. Notes + +Note that Ver Structural Verilog Compiler AET files are no longer supported. +They have been superceded by LXT. Also note that the AMULET group will be +taking over maintenance of the viewer effective immediately. + + +Add these flags to your compile for new warnings on AMD64: +`-g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic` + +on i386: +`-g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables` + +## Note (1) For Ubuntu users: + +I had to do the following to get it to install directly. Please +include in INSTALL .txt as an option for ubuntu users. Other linux +distributions might have other things to do. + +```sh +sudo apt-get install libgtk2.0-dev +./configure --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4 +``` + + +## Note (2) For Ubuntu users: + +If your compile fails because gzopen64 cannot be found, you will either have +to fix your Ubuntu install or use the version of libz in gtkwave: + +```sh +./configure --enable-local-libz +``` + +## Note (3) For Ubuntu users (version 11.10): + +```sh +sudo apt-get install libjudy-dev +sudo apt-get install libbz2-dev +sudo apt-get install liblzma-dev +sudo apt-get install libgconf2-dev +sudo apt-get install libgtk2.0-dev +sudo apt-get install tcl-dev +sudo apt-get install tk-dev +sudo apt-get install gperf +sudo apt-get install gtk2-engines-pixbuf +``` + +Configure then as: + +```sh +./configure --enable-judy --enable-struct-pack --with-gconf +``` + + +## Notes for Mac OSX users: + +Install MacPorts then + +```sh +sudo port -v selfupdate +sudo port install Judy tcl tk xz-devel gtk2 +``` + +If Quartz is used: + +```sh +sudo port install gtk-osx-application + +./configure --prefix=/opt/local --enable-judy --enable-struct-pack "CFLAGS=-I/opt/local/include -O2 -g" LDFLAGS=-L/opt/local/lib --no-create --no-recursion +``` + +Tcl works in the OSX version of gtkwave starting with version 3.3.26. + +At this point all features working on Linux should be functional on the Mac, +except that twinwave does not render to a single window when Quartz is used +instead of X11. + +If you wish to use llvm, also add `CC=llvm-gcc` and change the `-O2` in CFLAGS +to `-O4`. + +At the current time Quartz support is experimental. Please report any bugs +encountered as compared to X11 function. + +Note that the preferred environment for Quartz builds is jhbuild. To build +gtkwave as an app bundle (while in jhbuild shell): + +```sh +./configure --enable-judy --enable-struct-pack --prefix=/Users/$USER/gtk/inst +make +make install +cd contrib/bundle_for_osx +./make_bundle.sh +``` + +This assumes that Judy arrays and XZ were both already compiled and installed. +If Judy arrays are not installed, do not add `--enable-judy`. +If XZ is not installed, add `--disable-xz`. + +The current environment used is modulesets. Bug 664894 has an interim fix in +the binary distribution by applying patches using the +`contrib/bundle_for_osx/gtk_diff_against_modulesets.patch` file. + +## MSYS2 notes for creating a working environment for compiling gtkwave: + +```sh +pacman -Syuu +[repeat "pacman -Syuu" multiple times until environment stabilizes] +pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git subversion mercurial mingw-w64-i686-cmake mingw-w64-x86_64-cmake +pacman -S base-devel mingw-w64-toolchain mingw-w64-i686-gtk2 +pacman -S mingw-w64-i686-gtk2 +pacman -S mingw-w64-x86_64-gtk2 +pacman -S mingw-w64-i686-gtk3 +pacman -S mingw-w64-x86_64-gtk3 +``` + + +Add `--enable-gtk3` to the `./configure` invocation to build against GTK3. +This causes the GTK+ frontend to be built with gtk3 instead of gtk2. + diff -Nru gtkwave-3.3.114/configure gtkwave-3.3.118/configure --- gtkwave-3.3.114/configure 2022-11-23 05:58:01.000000000 +0000 +++ gtkwave-3.3.118/configure 2023-12-31 21:11:03.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gtkwave-gtk3 3.3.114. +# Generated by GNU Autoconf 2.69 for gtkwave-gtk3 3.3.118. # # Report bugs to . # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='gtkwave-gtk3' PACKAGE_TARNAME='gtkwave-gtk3' -PACKAGE_VERSION='3.3.114' -PACKAGE_STRING='gtkwave-gtk3 3.3.114' +PACKAGE_VERSION='3.3.118' +PACKAGE_STRING='gtkwave-gtk3 3.3.118' PACKAGE_BUGREPORT='bybell@rocketmail.com' PACKAGE_URL='' @@ -1395,7 +1395,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gtkwave-gtk3 3.3.114 to adapt to many kinds of systems. +\`configure' configures gtkwave-gtk3 3.3.118 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1461,7 +1461,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gtkwave-gtk3 3.3.114:";; + short | recursive ) echo "Configuration of gtkwave-gtk3 3.3.118:";; esac cat <<\_ACEOF @@ -1609,7 +1609,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gtkwave-gtk3 configure 3.3.114 +gtkwave-gtk3 configure 3.3.118 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2253,7 +2253,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gtkwave-gtk3 $as_me 3.3.114, which was +It was created by gtkwave-gtk3 $as_me 3.3.118, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3120,7 +3120,7 @@ # Define the identity of the package. PACKAGE='gtkwave-gtk3' - VERSION='3.3.114' + VERSION='3.3.118' cat >>confdefs.h <<_ACEOF @@ -11568,7 +11568,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gtkwave-gtk3 $as_me 3.3.114, which was +This file was extended by gtkwave-gtk3 $as_me 3.3.118, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11634,7 +11634,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gtkwave-gtk3 config.status 3.3.114 +gtkwave-gtk3 config.status 3.3.118 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru gtkwave-3.3.114/configure.ac gtkwave-3.3.118/configure.ac --- gtkwave-3.3.114/configure.ac 2022-11-23 05:57:05.000000000 +0000 +++ gtkwave-3.3.118/configure.ac 2023-12-31 21:11:03.000000000 +0000 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(gtkwave-gtk3, 3.3.114, bybell@rocketmail.com) +AC_INIT(gtkwave-gtk3, 3.3.118, bybell@rocketmail.com) AC_CONFIG_SRCDIR([src/vcd.c]) AM_INIT_AUTOMAKE AC_CONFIG_HEADER([config.h]) diff -Nru gtkwave-3.3.114/contrib/bundle_for_osx/Info-gtkwave.plist gtkwave-3.3.118/contrib/bundle_for_osx/Info-gtkwave.plist --- gtkwave-3.3.114/contrib/bundle_for_osx/Info-gtkwave.plist 2022-11-23 05:57:52.000000000 +0000 +++ gtkwave-3.3.118/contrib/bundle_for_osx/Info-gtkwave.plist 2023-12-31 21:11:03.000000000 +0000 @@ -8,7 +8,7 @@ CFBundleExecutable gtkwave CFBundleGetInfoString - 3.3.114, (C) 1999-2023 Tony Bybell http://gtkwave.sourceforge.net + 3.3.118, (C) 1999-2023 Tony Bybell http://gtkwave.sourceforge.net CFBundleIconFile gtkwave.icns CFBundleIdentifier @@ -18,11 +18,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.3.114 + 3.3.118 CFBundleSignature ???? CFBundleVersion - 3.3.114 + 3.3.118 NSHumanReadableCopyright Copyright 1999 - 2023 Tony Bybell, GNU General Public License. LSMinimumSystemVersion diff -Nru gtkwave-3.3.114/contrib/vpi/Makefile.am gtkwave-3.3.118/contrib/vpi/Makefile.am --- gtkwave-3.3.114/contrib/vpi/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ gtkwave-3.3.118/contrib/vpi/Makefile.am 2023-12-31 21:11:03.000000000 +0000 @@ -0,0 +1,30 @@ +## -*- makefile -*- +## +## To compile this, add AC_PROG_LIBTOOL to configure.ac +## also add contrib/vpi/Makefile to AC_CONFIG_FILES +## also run libtoolize to generate ltmain.sh. +## +## This is not built by default. In the future this will be a normal part of +## the build process. +## +## Note that this explicitly uses the libz library found in this +## distro as this might be necessary if your simulator is not already linked +## against it. +## +## 20jan09ajb +## + +lib_LTLIBRARIES= libsysfst.la + +libsysvzt_la_SOURCES= ../../src/libz/adler32.c ../../src/libz/compress.c ../../src/libz/crc32.c ../../src/libz/crc32.h \ + ../../src/libz/deflate.c ../../src/libz/deflate.h ../../src/libz/gzio.c ../../src/libz/infback.c ../../src/libz/inffast.c \ + ../../src/libz/inffast.h ../../src/libz/inffixed.h ../../src/libz/inflate.c ../../src/libz/inflate.h \ + ../../src/libz/inftrees.c ../../src/libz/inftrees.h ../../src/libz/trees.c ../../src/libz/trees.h ../../src/libz/uncompr.c \ + ../../src/libz/zconf.h ../../src/libz/zlib.h ../../src/libz/zutil.c ../../src/libz/zutil.h \ + ../../src/helpers/fst/fstapi.c ../../src/helpers/fst/fstapi.h ../../src/helpers/fst/fastlz.c ../../src/helpers/fst/fastlz.h \ + sys_fst.c + + +libsysfst_la_LDFLAGS = -version-info 1:0:0 + +AM_CFLAGS= -I../../src/libz/ -I../../src/helpers/fst/ -I. diff -Nru gtkwave-3.3.114/contrib/vpi/acc_user.h gtkwave-3.3.118/contrib/vpi/acc_user.h --- gtkwave-3.3.114/contrib/vpi/acc_user.h 1970-01-01 00:00:00.000000000 +0000 +++ gtkwave-3.3.118/contrib/vpi/acc_user.h 2023-12-31 21:11:03.000000000 +0000 @@ -0,0 +1,568 @@ +/***************************************************************************** + * acc_user.h + * + * IEEE 1364-2000 Verilog HDL Programming Language Interface (PLI). + * + * This file contains the constant definitions, structure definitions, and + * routine declarations for the Verilog Programming Language Interface ACC + * access routines. + * + ****************************************************************************/ + +#ifndef ACC_USER_H +#define ACC_USER_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/*---------------------------------------------------------------------------*/ +/*--------------------------- Portability Help ------------------------------*/ +/*---------------------------------------------------------------------------*/ +/* Sized variables */ +#ifndef PLI_TYPES +#define PLI_TYPES +typedef int PLI_INT32; +typedef unsigned int PLI_UINT32; +typedef short PLI_INT16; +typedef unsigned short PLI_UINT16; +typedef char PLI_BYTE8; +typedef unsigned char PLI_UBYTE8; +#endif + +/* export a symbol */ +#if WIN32 +#ifndef PLI_DLLISPEC +#define PLI_DLLISPEC __declspec(dllimport) +#define ACC_USER_DEFINED_DLLISPEC 1 +#endif +#else +#ifndef PLI_DLLISPEC +#define PLI_DLLISPEC +#endif +#endif + +/* import a symbol */ +#if WIN32 +#ifndef PLI_DLLESPEC +#define PLI_DLLESPEC __declspec(dllexport) +#define ACC_USER_DEFINED_DLLESPEC 1 +#endif +#else +#ifndef PLI_DLLESPEC +#define PLI_DLLESPEC +#endif +#endif + +/* mark a function as external */ +#ifndef PLI_EXTERN +#define PLI_EXTERN +#endif + +/* mark a variable as external */ +#ifndef PLI_VEXTERN +#define PLI_VEXTERN extern +#endif + +#ifndef PLI_PROTOTYPES +#define PLI_PROTOTYPES +#define PROTO_PARAMS(params) params +/* object is imported by the application */ +#define XXTERN PLI_EXTERN PLI_DLLISPEC +/* object is exported by the application */ +#define EETERN PLI_EXTERN PLI_DLLESPEC +#endif + +/* + * The following group of defines exists purely for backwards compatibility + */ +#ifndef PLI_EXTRAS +#define PLI_EXTRAS +#define bool int +#define true 1 +#define TRUE 1 +#define false 0 +#define FALSE 0 +#define null 0L +#endif + + +/*---------------------------------------------------------------------------*/ +/*------------------------------- definitions -------------------------------*/ +/*---------------------------------------------------------------------------*/ + +/*----------------------------- general defines -----------------------------*/ +typedef PLI_INT32 *HANDLE; +#ifndef VPI_USER_CDS_H +typedef PLI_INT32 *handle; +#endif + +/*------------------------------- object types ------------------------------*/ +#define accModule 20 +#define accScope 21 +#define accNet 25 +#define accReg 30 +#define accRegister accReg +#define accPort 35 +#define accTerminal 45 +#define accInputTerminal 46 +#define accOutputTerminal 47 +#define accInoutTerminal 48 +#define accCombPrim 140 +#define accSeqPrim 142 +#define accAndGate 144 +#define accNandGate 146 +#define accNorGate 148 +#define accOrGate 150 +#define accXorGate 152 +#define accXnorGate 154 +#define accBufGate 156 +#define accNotGate 158 +#define accBufif0Gate 160 +#define accBufif1Gate 162 +#define accNotif0Gate 164 +#define accNotif1Gate 166 +#define accNmosGate 168 +#define accPmosGate 170 +#define accCmosGate 172 +#define accRnmosGate 174 +#define accRpmosGate 176 +#define accRcmosGate 178 +#define accRtranGate 180 +#define accRtranif0Gate 182 +#define accRtranif1Gate 184 +#define accTranGate 186 +#define accTranif0Gate 188 +#define accTranif1Gate 190 +#define accPullupGate 192 +#define accPulldownGate 194 +#define accIntegerParam 200 +#define accIntParam accIntegerParam +#define accRealParam 202 +#define accStringParam 204 +#define accPath 206 +#define accTchk 208 +#define accPrimitive 210 +#define accBit 212 +#define accPortBit 214 +#define accNetBit 216 +#define accRegBit 218 +#define accParameter 220 +#define accSpecparam 222 +#define accTopModule 224 +#define accModuleInstance 226 +#define accCellInstance 228 +#define accModPath 230 +#define accWirePath 234 +#define accInterModPath 236 +#define accScalarPort 250 +#define accBitSelectPort 252 +#define accPartSelectPort 254 +#define accVectorPort 256 +#define accConcatPort 258 +#define accWire 260 +#define accWand 261 +#define accWor 262 +#define accTri 263 +#define accTriand 264 +#define accTrior 265 +#define accTri0 266 +#define accTri1 267 +#define accTrireg 268 +#define accSupply0 269 +#define accSupply1 270 +#define accNamedEvent 280 +#define accEventVar accNamedEvent +#define accIntegerVar 281 +#define accIntVar 281 +#define accRealVar 282 +#define accTimeVar 283 +#define accScalar 300 +#define accVector 302 +#define accCollapsedNet 304 +#define accExpandedVector 306 +#define accUnExpandedVector 307 +#define accProtected 308 +#define accSetup 366 +#define accHold 367 +#define accWidth 368 +#define accPeriod 369 +#define accRecovery 370 +#define accSkew 371 +#define accNochange 376 +#define accNoChange accNochange +#define accSetuphold 377 +#define accInput 402 +#define accOutput 404 +#define accInout 406 +#define accMixedIo 407 +#define accPositive 408 +#define accNegative 410 +#define accUnknown 412 +#define accPathTerminal 420 +#define accPathInput 422 +#define accPathOutput 424 +#define accDataPath 426 +#define accTchkTerminal 428 +#define accBitSelect 500 +#define accPartSelect 502 +#define accTask 504 +#define accFunction 506 +#define accStatement 508 +#define accTaskCall 510 +#define accFunctionCall 512 +#define accSystemTask 514 +#define accSystemFunction 516 +#define accSystemRealFunction 518 +#define accUserTask 520 +#define accUserFunction 522 +#define accUserRealFunction 524 +#define accNamedBeginStat 560 +#define accNamedForkStat 564 +#define accConstant 600 +#define accConcat 610 +#define accOperator 620 +#define accMinTypMax 696 +#define accModPathHasIfnone 715 + +/*------------------ parameter values for acc_configure() -------------------*/ +#define accPathDelayCount 1 +#define accPathDelimStr 2 +#define accDisplayErrors 3 +#define accDefaultAttr0 4 +#define accToHiZDelay 5 +#define accEnableArgs 6 +#define accDisplayWarnings 8 +#define accDevelopmentVersion 11 +#define accMapToMipd 17 +#define accMinTypMaxDelays 19 + +/*------------ edge information used by acc_handle_tchk(), etc. ------------*/ +#define accNoedge 0 +#define accNoEdge 0 +#define accEdge01 1 +#define accEdge10 2 +#define accEdge0x 4 +#define accEdgex1 8 +#define accEdge1x 16 +#define accEdgex0 32 +#define accPosedge 13 +#define accPosEdge accPosedge +#define accNegedge 50 +#define accNegEdge accNegedge + +/*------------------------------- delay modes -------------------------------*/ +#define accDelayModeNone 0 +#define accDelayModePath 1 +#define accDelayModeDistrib 2 +#define accDelayModeUnit 3 +#define accDelayModeZero 4 +#define accDelayModeMTM 5 + +/*------------ values for type field in t_setval_delay structure ------------*/ +#define accNoDelay 0 +#define accInertialDelay 1 +#define accTransportDelay 2 +#define accPureTransportDelay 3 +#define accForceFlag 4 +#define accReleaseFlag 5 +#define accAssignFlag 6 +#define accDeassignFlag 7 + +/*------------ values for type field in t_setval_value structure ------------*/ +#define accBinStrVal 1 +#define accOctStrVal 2 +#define accDecStrVal 3 +#define accHexStrVal 4 +#define accScalarVal 5 +#define accIntVal 6 +#define accRealVal 7 +#define accStringVal 8 +#define accVectorVal 10 + +/*------------------------------ scalar values ------------------------------*/ +#define acc0 0 +#define acc1 1 +#define accX 2 +#define accZ 3 + +/*---------------------------- VCL scalar values ----------------------------*/ +#define vcl0 acc0 +#define vcl1 acc1 +#define vclX accX +#define vclx vclX +#define vclZ accZ +#define vclz vclZ + +/*----------- values for vc_reason field in t_vc_record structure -----------*/ +#define logic_value_change 1 +#define strength_value_change 2 +#define real_value_change 3 +#define vector_value_change 4 +#define event_value_change 5 +#define integer_value_change 6 +#define time_value_change 7 +#define sregister_value_change 8 +#define vregister_value_change 9 +#define realtime_value_change 10 + +/*--------------------------- VCL strength values ---------------------------*/ +#define vclSupply 7 +#define vclStrong 6 +#define vclPull 5 +#define vclLarge 4 +#define vclWeak 3 +#define vclMedium 2 +#define vclSmall 1 +#define vclHighZ 0 + +/*----------------------- flags used with acc_vcl_add -----------------------*/ +#define vcl_verilog_logic 2 +#define VCL_VERILOG_LOGIC vcl_verilog_logic +#define vcl_verilog_strength 3 +#define VCL_VERILOG_STRENGTH vcl_verilog_strength + +/*---------------------- flags used with acc_vcl_delete ---------------------*/ +#define vcl_verilog vcl_verilog_logic +#define VCL_VERILOG vcl_verilog + +/*---------- values for the type field in the t_acc_time structure --------- */ +#define accTime 1 +#define accSimTime 2 +#define accRealTime 3 + +/*------------------------------ product types ------------------------------*/ +#define accSimulator 1 +#define accTimingAnalyzer 2 +#define accFaultSimulator 3 +#define accOther 4 + + +/*---------------------------------------------------------------------------*/ +/*-------------------------- structure definitions --------------------------*/ +/*---------------------------------------------------------------------------*/ + +typedef PLI_INT32 (*consumer_function)(); + +/*----------------- data structure used with acc_set_value() ----------------*/ +typedef struct t_acc_time +{ + PLI_INT32 type; + PLI_INT32 low, + high; + double real; +} s_acc_time, *p_acc_time; + +/*----------------- data structure used with acc_set_value() ----------------*/ +typedef struct t_setval_delay +{ + s_acc_time time; + PLI_INT32 model; +} s_setval_delay, *p_setval_delay; + +/*--------------------- data structure of vector values ---------------------*/ +typedef struct t_acc_vecval +{ + PLI_INT32 aval; + PLI_INT32 bval; +} s_acc_vecval, *p_acc_vecval; + +/*------ data structure used with acc_set_value() and acc_fetch_value() -----*/ +typedef struct t_setval_value +{ + PLI_INT32 format; + union + { + PLI_BYTE8 *str; + PLI_INT32 scalar; + PLI_INT32 integer; + double real; + p_acc_vecval vector; + } value; +} s_setval_value, *p_setval_value, s_acc_value, *p_acc_value; + +/*----------------------- structure for VCL strengths -----------------------*/ +typedef struct t_strengths +{ + PLI_UBYTE8 logic_value; + PLI_UBYTE8 strength1; + PLI_UBYTE8 strength2; +} s_strengths, *p_strengths; + +/*--------------- structure passed to callback routine for VCL --------------*/ +typedef struct t_vc_record +{ + PLI_INT32 vc_reason; + PLI_INT32 vc_hightime; + PLI_INT32 vc_lowtime; + PLI_BYTE8 *user_data; + union + { + PLI_UBYTE8 logic_value; + double real_value; + handle vector_handle; + s_strengths strengths_s; + } out_value; +} s_vc_record, *p_vc_record; + +/*------------- structure used with acc_fetch_location() routine ------------*/ +typedef struct t_location +{ + PLI_INT32 line_no; + PLI_BYTE8 *filename; +} s_location, *p_location; + +/*---------- structure used with acc_fetch_timescale_info() routine ---------*/ +typedef struct t_timescale_info +{ + PLI_INT16 unit; + PLI_INT16 precision; +} s_timescale_info, *p_timescale_info; + + +/*---------------------------------------------------------------------------*/ +/*-------------------------- routine declarations ---------------------------*/ +/*---------------------------------------------------------------------------*/ + +XXTERN PLI_INT32 acc_append_delays PROTO_PARAMS((handle object, ...)); +XXTERN PLI_INT32 acc_append_pulsere PROTO_PARAMS((handle object, double val1r, double val1x, ...)); +XXTERN void acc_close PROTO_PARAMS((void)); +XXTERN handle *acc_collect PROTO_PARAMS((handle (*p_next_routine)(), handle scope_object, PLI_INT32 *aof_count)); +XXTERN PLI_INT32 acc_compare_handles PROTO_PARAMS((handle h1, handle h2)); +XXTERN PLI_INT32 acc_configure PROTO_PARAMS((PLI_INT32 item, PLI_BYTE8 *value)); +XXTERN PLI_INT32 acc_count PROTO_PARAMS((handle (*next_func)(), handle object_handle)); +XXTERN PLI_INT32 acc_fetch_argc PROTO_PARAMS((void)); +XXTERN PLI_BYTE8 **acc_fetch_argv PROTO_PARAMS((void)); +XXTERN double acc_fetch_attribute PROTO_PARAMS((handle object, ...)); +XXTERN PLI_INT32 acc_fetch_attribute_int PROTO_PARAMS((handle object, ...)); +XXTERN PLI_BYTE8 *acc_fetch_attribute_str PROTO_PARAMS((handle object, ...)); +XXTERN PLI_BYTE8 *acc_fetch_defname PROTO_PARAMS((handle object_handle)); +XXTERN PLI_INT32 acc_fetch_delay_mode PROTO_PARAMS((handle object_p)); +XXTERN PLI_INT32 acc_fetch_delays PROTO_PARAMS((handle object, ...)); +XXTERN PLI_INT32 acc_fetch_direction PROTO_PARAMS((handle object_handle)); +XXTERN PLI_INT32 acc_fetch_edge PROTO_PARAMS((handle acc_obj)); +XXTERN PLI_BYTE8 *acc_fetch_fullname PROTO_PARAMS((handle object_handle)); +XXTERN PLI_INT32 acc_fetch_fulltype PROTO_PARAMS((handle object_h)); +XXTERN PLI_INT32 acc_fetch_index PROTO_PARAMS((handle object_handle)); +XXTERN double acc_fetch_itfarg PROTO_PARAMS((PLI_INT32 n, handle tfinst)); +XXTERN PLI_INT32 acc_fetch_itfarg_int PROTO_PARAMS((PLI_INT32 n, handle tfinst)); +XXTERN PLI_BYTE8 *acc_fetch_itfarg_str PROTO_PARAMS((PLI_INT32 n, handle tfinst)); +XXTERN PLI_INT32 acc_fetch_location PROTO_PARAMS((p_location location_p, handle object)); +XXTERN PLI_BYTE8 *acc_fetch_name PROTO_PARAMS((handle object_handle)); +XXTERN PLI_INT32 acc_fetch_paramtype PROTO_PARAMS((handle param_p)); +XXTERN double acc_fetch_paramval PROTO_PARAMS((handle param)); +XXTERN PLI_INT32 acc_fetch_polarity PROTO_PARAMS((handle path)); +XXTERN PLI_INT32 acc_fetch_precision PROTO_PARAMS((void)); +XXTERN PLI_INT32 acc_fetch_pulsere PROTO_PARAMS((handle path_p, double *val1r, double *val1e, ...)); +XXTERN PLI_INT32 acc_fetch_range PROTO_PARAMS((handle node, PLI_INT32 *msb, PLI_INT32 *lsb)); +XXTERN PLI_INT32 acc_fetch_size PROTO_PARAMS((handle obj_h)); +XXTERN double acc_fetch_tfarg PROTO_PARAMS((PLI_INT32 n)); +XXTERN PLI_INT32 acc_fetch_tfarg_int PROTO_PARAMS((PLI_INT32 n)); +XXTERN PLI_BYTE8 *acc_fetch_tfarg_str PROTO_PARAMS((PLI_INT32 n)); +XXTERN void acc_fetch_timescale_info PROTO_PARAMS((handle obj, p_timescale_info aof_timescale_info)); +XXTERN PLI_INT32 acc_fetch_type PROTO_PARAMS((handle object_handle)); +XXTERN PLI_BYTE8 *acc_fetch_type_str PROTO_PARAMS((PLI_INT32 type)); +XXTERN PLI_BYTE8 *acc_fetch_value PROTO_PARAMS((handle object_handle, PLI_BYTE8 *format_str, p_acc_value acc_value_p)); +XXTERN void acc_free PROTO_PARAMS((handle *array_ptr)); +XXTERN handle acc_handle_by_name PROTO_PARAMS((PLI_BYTE8 *inst_name, handle scope_p)); +XXTERN handle acc_handle_condition PROTO_PARAMS((handle obj)); +XXTERN handle acc_handle_conn PROTO_PARAMS((handle term_p)); +XXTERN handle acc_handle_datapath PROTO_PARAMS((handle path)); +XXTERN handle acc_handle_hiconn PROTO_PARAMS((handle port_ref)); +XXTERN handle acc_handle_interactive_scope PROTO_PARAMS((void)); +XXTERN handle acc_handle_itfarg PROTO_PARAMS((PLI_INT32 n, handle tfinst)); +XXTERN handle acc_handle_loconn PROTO_PARAMS((handle port_ref)); +XXTERN handle acc_handle_modpath PROTO_PARAMS((handle mod_p, PLI_BYTE8 *pathin_name, PLI_BYTE8 *pathout_name, ...)); +XXTERN handle acc_handle_notifier PROTO_PARAMS((handle tchk)); +XXTERN handle acc_handle_object PROTO_PARAMS((PLI_BYTE8 *inst_name, ...)); +XXTERN handle acc_handle_parent PROTO_PARAMS((handle object_p)); +XXTERN handle acc_handle_path PROTO_PARAMS((handle source, handle destination)); +XXTERN handle acc_handle_pathin PROTO_PARAMS((handle path_p)); +XXTERN handle acc_handle_pathout PROTO_PARAMS((handle path_p)); +XXTERN handle acc_handle_port PROTO_PARAMS((handle mod_handle, PLI_INT32 port_num, ...)); +XXTERN handle acc_handle_scope PROTO_PARAMS((handle object)); +XXTERN handle acc_handle_simulated_net PROTO_PARAMS((handle net_h)); +XXTERN handle acc_handle_tchk PROTO_PARAMS((handle mod_p, PLI_INT32 tchk_type, PLI_BYTE8 *arg1_conn_name, PLI_INT32 arg1_edgetype, ...)); +XXTERN handle acc_handle_tchkarg1 PROTO_PARAMS((handle tchk)); +XXTERN handle acc_handle_tchkarg2 PROTO_PARAMS((handle tchk)); +XXTERN handle acc_handle_terminal PROTO_PARAMS((handle gate_handle, PLI_INT32 terminal_index)); +XXTERN handle acc_handle_tfarg PROTO_PARAMS((PLI_INT32 n)); +XXTERN handle acc_handle_tfinst PROTO_PARAMS((void)); +XXTERN PLI_INT32 acc_initialize PROTO_PARAMS((void)); +XXTERN handle acc_next PROTO_PARAMS((PLI_INT32 *type_list, handle h_scope, handle h_object)); +XXTERN handle acc_next_bit PROTO_PARAMS ((handle vector, handle bit)); +XXTERN handle acc_next_cell PROTO_PARAMS((handle scope, handle cell)); +XXTERN handle acc_next_cell_load PROTO_PARAMS((handle net_handle, handle load)); +XXTERN handle acc_next_child PROTO_PARAMS((handle mod_handle, handle child)); +XXTERN handle acc_next_driver PROTO_PARAMS((handle net, handle driver)); +XXTERN handle acc_next_hiconn PROTO_PARAMS((handle port, handle hiconn)); +XXTERN handle acc_next_input PROTO_PARAMS((handle path, handle pathin)); +XXTERN handle acc_next_load PROTO_PARAMS((handle net, handle load)); +XXTERN handle acc_next_loconn PROTO_PARAMS((handle port, handle loconn)); +XXTERN handle acc_next_modpath PROTO_PARAMS((handle mod_p, handle path)); +XXTERN handle acc_next_net PROTO_PARAMS((handle mod_handle, handle net)); +XXTERN handle acc_next_output PROTO_PARAMS((handle path, handle pathout)); +XXTERN handle acc_next_parameter PROTO_PARAMS((handle module_p, handle param)); +XXTERN handle acc_next_port PROTO_PARAMS((handle ref_obj_p, handle port)); +XXTERN handle acc_next_portout PROTO_PARAMS((handle mod_p, handle port)); +XXTERN handle acc_next_primitive PROTO_PARAMS((handle mod_handle, handle prim)); +XXTERN handle acc_next_scope PROTO_PARAMS((handle ref_scope_p, handle scope)); +XXTERN handle acc_next_specparam PROTO_PARAMS((handle module_p, handle sparam)); +XXTERN handle acc_next_tchk PROTO_PARAMS((handle mod_p, handle tchk)); +XXTERN handle acc_next_terminal PROTO_PARAMS((handle gate_handle, handle term)); +XXTERN handle acc_next_topmod PROTO_PARAMS((handle topmod)); +XXTERN PLI_INT32 acc_object_in_typelist PROTO_PARAMS((handle object, PLI_INT32 *type_list)); +XXTERN PLI_INT32 acc_object_of_type PROTO_PARAMS((handle object, PLI_INT32 type)); +XXTERN PLI_INT32 acc_product_type PROTO_PARAMS((void)); +XXTERN PLI_BYTE8 *acc_product_version PROTO_PARAMS((void)); +XXTERN PLI_INT32 acc_release_object PROTO_PARAMS((handle obj)); +XXTERN PLI_INT32 acc_replace_delays PROTO_PARAMS((handle object, ...)); +XXTERN PLI_INT32 acc_replace_pulsere PROTO_PARAMS((handle object, double val1r, double val1x, ...)); +XXTERN void acc_reset_buffer PROTO_PARAMS((void)); +XXTERN PLI_INT32 acc_set_interactive_scope PROTO_PARAMS((handle scope, PLI_INT32 callback_flag)); +XXTERN PLI_INT32 acc_set_pulsere PROTO_PARAMS((handle path_p, double val1r, double val1e)); +XXTERN PLI_BYTE8 *acc_set_scope PROTO_PARAMS((handle object, ...)); +XXTERN PLI_INT32 acc_set_value PROTO_PARAMS((handle obj, p_setval_value setval_p, p_setval_delay delay_p)); +XXTERN void acc_vcl_add PROTO_PARAMS((handle object_p, PLI_INT32 (*consumer)(p_vc_record), PLI_BYTE8 *user_data, PLI_INT32 vcl_flags)); +XXTERN void acc_vcl_delete PROTO_PARAMS((handle object_p, PLI_INT32 (*consumer)(p_vc_record), PLI_BYTE8 *user_data, PLI_INT32 vcl_flags)); +XXTERN PLI_BYTE8 *acc_version PROTO_PARAMS((void)); + + +/*---------------------------------------------------------------------------*/ +/*----------------------- global variable definitions -----------------------*/ +/*---------------------------------------------------------------------------*/ + +PLI_VEXTERN PLI_DLLISPEC PLI_INT32 acc_error_flag; + + +/*---------------------------------------------------------------------------*/ +/*---------------------------- macro definitions ----------------------------*/ +/*---------------------------------------------------------------------------*/ + +#define acc_handle_calling_mod_m acc_handle_parent((handle)tf_getinstance()) + +#undef PLI_EXTERN +#undef PLI_VEXTERN + +#ifdef ACC_USER_DEFINED_DLLISPEC +#undef ACC_USER_DEFINED_DLLISPEC +#undef PLI_DLLISPEC +#endif +#ifdef ACC_USER_DEFINED_DLLESPEC +#undef ACC_USER_DEFINED_DLLESPEC +#undef PLI_DLLESPEC +#endif + +#ifdef PLI_PROTOTYPES +#undef PLI_PROTOTYPES +#undef PROTO_PARAMS +#undef XXTERN +#undef EETERN +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ACC_USER_H */ diff -Nru gtkwave-3.3.114/contrib/vpi/sys_fst.c gtkwave-3.3.118/contrib/vpi/sys_fst.c --- gtkwave-3.3.114/contrib/vpi/sys_fst.c 1970-01-01 00:00:00.000000000 +0000 +++ gtkwave-3.3.118/contrib/vpi/sys_fst.c 2023-12-31 21:11:03.000000000 +0000 @@ -0,0 +1,816 @@ +/* + +FST dumper for NC Verilog / Verilog-XL +to compile/run under AIX: + +ar -xv /lib/libz.a # to get libz.so.1 +xlc -O3 -c sys_fst.c fstapi.c fastlz.c +ld -G -o sys_fst.so sys_fst.o fstapi.o fastlz.o libz.so.1 -bnoentry -bexpall -lld -lc + +[nc]verilog r.v +loadvpi=sys_fst.so:sys_fst_register +access+r + + +FST dumper for VCS +to compile/run under LINUX: + +gcc -O2 -c -fPIC *.c +ld -G -o sys_fst.so ../../src/libz/*.o *.o +vcs +v2k -R +vpi +acc+2 +memchbk -full64 t.v -P sys_fst.tab sys_fst.so + +sys_fst.tab: + +$fstdumpfile check=sys_dumpfile_compiletf call=sys_dumpfile_calltf acc+=r:* +$fstdumpvars check=sys_dumpvars_compiletf call=sys_dumpvars_calltf acc+=r:* +$fstdumpoff check=sys_dumpoff_compiletf call=sys_dumpoff_calltf acc+=r:* + + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "fstapi.h" + +struct fst_info { + struct fst_info *dump_chain; + vpiHandle item; + s_vpi_value value; + + fstHandle fstSym; + unsigned is_real:1; + unsigned is_changed:1; +}; + +/*************************************************/ + +static struct fstContext *ctx = NULL; +static uint64_t prev64 = 0; + +static char *dump_path = NULL; + +static int dump_is_off = 0; + +static struct fst_info *fst_dump_list = 0; + +static int dumpvars_status = 0; /* 0:fresh 1:cb installed, + * 2:callback done */ +static uint64_t dumpvars_time; + + +static uint64_t +timerec_to_time64(s_vpi_time * vt) +{ + uint64_t hi = vt->high; + uint64_t lo = vt->low; + + return ((hi << 32) | lo); +} + + +static int +dump_header_pending(void) +{ + return (dumpvars_status != 2); +} + + +int variable_cb_rosync(p_cb_data cause); + + +int +variable_cb_rosync(p_cb_data cause) +{ + p_vpi_time tim = cause->time; + uint64_t now64 = timerec_to_time64(tim); + struct fst_info *a_info = fst_dump_list; + s_vpi_value value; + + if((now64 > prev64) || (!now64)) + { + fstWriterEmitTimeChange(ctx, now64); + prev64 = now64; + } + + while (a_info) { + if (!a_info->is_real) { + value.value.str = NULL; + value.format = vpiBinStrVal; + + vpi_get_value(a_info->item, &value); + fstWriterEmitValueChange(ctx, a_info->fstSym, value.value.str); + } else { + double d; + value.format = vpiRealVal; + + vpi_get_value(a_info->item, &value); + d = value.value.real; + fstWriterEmitValueChange(ctx, a_info->fstSym, &d); + } + + + a_info->is_changed = 0; + struct fst_info *a_info_next = a_info->dump_chain; + a_info->dump_chain = NULL; + a_info = a_info_next; + } + + fst_dump_list = NULL; + return (0); + +} + + +static void +install_rosync_cb(void) +{ + struct t_cb_data cb; + struct t_vpi_time time; + + memset(&cb, 0, sizeof(cb)); + memset(&time, 0, sizeof(time)); + time.type = vpiSimTime; + + cb.time = &time; + cb.reason = cbReadOnlySynch; + cb.cb_rtn = variable_cb_rosync; + cb.user_data = NULL; + cb.obj = NULL; + + vpi_free_object(vpi_register_cb(&cb)); +} + + +int +variable_cb(p_cb_data cause) +{ + struct fst_info *info = (struct fst_info *) cause->user_data; + + if (dump_is_off) + return (0); + if (dump_header_pending()) + return (0); + if (info->is_changed) + return (0); + + if (!fst_dump_list) { + install_rosync_cb(); + } + info->is_changed = 1; + info->dump_chain = fst_dump_list; + fst_dump_list = info; + + return (0); +} + + +static int +dumpvars_cb(p_cb_data cause) +{ + if (dumpvars_status != 1) + return (0); + + dumpvars_status = 2; + + dumpvars_time = timerec_to_time64(cause->time); + + return (0); +} + + +static int +install_dumpvars_callback(void) +{ + struct t_cb_data cb; + struct t_vpi_time time; + + if (dumpvars_status == 1) + return (0); + + if (dumpvars_status == 2) { + vpi_mcd_printf(1, "Error:" + " $fstdumpvars ignored," + " previously called at simtime %"PRIu64 + "\n", dumpvars_time); + return (1); + } + memset(&cb, 0, sizeof(cb)); + memset(&time, 0, sizeof(time)); + time.type = vpiSimTime; + cb.time = &time; + cb.reason = cbReadOnlySynch; + cb.cb_rtn = dumpvars_cb; + cb.user_data = NULL; + cb.obj = NULL; + + vpi_free_object(vpi_register_cb(&cb)); + + dumpvars_status = 1; + return (0); +} + + +static int +end_of_sim_cb(p_cb_data cause) +{ + if (ctx) + { + fstWriterClose(ctx); + ctx = NULL; + prev64 = 0; + } + return (0); +} + +static int +next_time_cb(p_cb_data cause) +{ +struct t_cb_data cb; +struct t_vpi_time vtime; + +p_vpi_time tim = cause->time; +uint64_t now64 = timerec_to_time64(tim); + +if(now64 > prev64) + { + fstWriterEmitTimeChange(ctx, now64); + prev64 = now64; + } + +memset(&cb, 0, sizeof(cb)); +memset(&vtime, 0, sizeof(vtime)); + +vtime.type = vpiSimTime; +cb.time = &vtime; +cb.reason = cbNextSimTime; +cb.cb_rtn = next_time_cb; +cb.user_data = NULL; +cb.obj = NULL; + +vpi_free_object(vpi_register_cb(&cb)); + +return (0); +} + + +static void +open_dumpfile(void) +{ + struct t_cb_data cb; + struct t_vpi_time vtime; + + if (dump_path == NULL) { + dump_path = strdup("dump.fst"); + } + { + time_t walltime; + + /* + * primary + */ + ctx = fstWriterCreate(dump_path, 1); + prev64 = 0; + fstWriterSetPackType(ctx, FST_WR_PT_LZ4); + /* fstWriterSetParallelMode(ctx, 1); */ + + time(&walltime); + fstWriterSetDate(ctx, asctime(localtime(&walltime))); + + fstWriterSetVersion(ctx, acc_product_version()); + + free(dump_path); + dump_path = NULL; + + memset(&cb, 0, sizeof(cb)); + memset(&vtime, 0, sizeof(vtime)); + + vtime.type = vpiSimTime; + cb.time = &vtime; + cb.reason = cbEndOfSimulation; + cb.cb_rtn = end_of_sim_cb; + cb.user_data = NULL; + cb.obj = NULL; + + vpi_free_object(vpi_register_cb(&cb)); + + memset(&cb, 0, sizeof(cb)); + memset(&vtime, 0, sizeof(vtime)); + + vtime.type = vpiSimTime; + cb.time = &vtime; + cb.reason = cbNextSimTime; + cb.cb_rtn = next_time_cb; + cb.user_data = NULL; + cb.obj = NULL; + + vpi_free_object(vpi_register_cb(&cb)); + } +} + + +int +sys_dumpfile_compiletf(char *name) +{ + vpiHandle sys = vpi_handle(vpiSysTfCall, 0); + vpiHandle argv = vpi_iterate(vpiArgument, sys); + vpiHandle item; + + char *path; + + if (argv && (item = vpi_scan(argv))) { + s_vpi_value value; + + if (vpi_get(vpiType, item) != vpiConstant + || vpi_get(vpiConstType, item) != vpiStringConst) { + vpi_mcd_printf(1, + "FST Error:" + " %s parameter must be a string constant\n", + name); + return (0); + } + value.format = vpiStringVal; + vpi_get_value(item, &value); + path = strdup(value.value.str); + + vpi_free_object(argv); + } else { + path = strdup("dump.fst"); + } + + if (dump_path) { + vpi_mcd_printf(1, "FST Warning:" + " Overriding dumpfile path %s with %s\n", + dump_path, path); + free(dump_path); + } + dump_path = path; + + return (0); +} + + +int +sys_dumpfile_calltf(char *name) +{ + return (0); +} + + +static int +draw_module_type(vpiHandle item, int typ) +{ + vpiHandle iter = vpi_iterate(typ, item); + vpiHandle net; + const char *name; + struct t_cb_data cb; + struct fst_info *info; + struct t_vpi_time time; + int vtyp; + int ilrange, + irrange; + + if (!iter) + return (0); + + while ((net = vpi_scan(iter))) { + int siz; + + info = calloc(1, sizeof(*info)); + + if (typ == vpiVariables) { + siz = vpi_get(vpiSize, net); + ilrange = siz - 1; + irrange = 0; + } else if (vpi_get(vpiVector, net)) { + s_vpi_value lvalue, + rvalue; + vpiHandle lrange = vpi_handle(vpiLeftRange, net); + vpiHandle rrange = vpi_handle(vpiRightRange, net); + + lvalue.value.integer = 0; + lvalue.format = vpiIntVal; + vpi_get_value(lrange, &lvalue); + + rvalue.value.integer = 0; + rvalue.format = vpiIntVal; + vpi_get_value(rrange, &rvalue); + + siz = vpi_get(vpiSize, net); + + ilrange = lvalue.value.integer; + irrange = rvalue.value.integer; + } else { + siz = 1; + ilrange = irrange = -1; + } + + name = vpi_get_str(vpiName, net); + + switch (typ) { + case vpiNet: + { + int vartype = vpi_get(vpiNetType, net); + switch (vartype) { + case vpiWand: + vtyp = FST_VT_VCD_WAND; + break; + case vpiWor: + vtyp = FST_VT_VCD_WOR; + break; + case vpiTri: + vtyp = FST_VT_VCD_TRI; + break; + case vpiTri0: + vtyp = FST_VT_VCD_TRI0; + break; + case vpiTri1: + vtyp = FST_VT_VCD_TRI1; + break; + case vpiTriReg: + vtyp = FST_VT_VCD_TRIREG; + break; + case vpiTriAnd: + vtyp = FST_VT_VCD_TRIAND; + break; + case vpiTriOr: + vtyp = FST_VT_VCD_TRIOR; + break; + case vpiSupply0: + vtyp = FST_VT_VCD_SUPPLY0; + break; + case vpiSupply1: + vtyp = FST_VT_VCD_SUPPLY1; + break; + case vpiWire: + default: + vtyp = FST_VT_VCD_WIRE; + break; + } + break; + } + case vpiReg: + vtyp = FST_VT_VCD_REG; + break; + case vpiVariables: + { + int vartype = vpi_get(vpiType, net); + switch (vartype) { + case vpiTimeVar: + vtyp = FST_VT_VCD_TIME; + break; + case vpiRealVar: + vtyp = FST_VT_VCD_REAL; + info->is_real = 1; + break; + case vpiIntegerVar: + default: + vtyp = FST_VT_VCD_INTEGER; + break; + } + } + break; + default: + vtyp = FST_VT_VCD_WIRE; + break; + } + + if (((ilrange == -1) && (irrange == -1)) || (typ == vpiVariables)) { + info->fstSym = + fstWriterCreateVar(ctx, vtyp, FST_VD_IMPLICIT, siz, name, + 0); + } else { + char *n2 = malloc(strlen(name) + 64); + int len = ilrange - irrange; + if(len < 0) len = - len; + len++; + + if (ilrange == irrange) { + if(siz == len) + { + sprintf(n2, "%s [%d]", name, irrange); + } + else + { + sprintf(n2, "%s [%d][%d:0]", name, irrange, siz/len-1); + } + } else { + if(siz == len) + { + sprintf(n2, "%s [%d:%d]", name, ilrange, irrange); + } + else + { + sprintf(n2, "%s [%d:%d][%d:0]", name, ilrange, irrange, siz/len-1); + } + } + + info->fstSym = + fstWriterCreateVar(ctx, vtyp, FST_VD_IMPLICIT, siz, n2, 0); + free(n2); + } + + info->item = net; + info->is_changed = 1; + + info->dump_chain = fst_dump_list; + fst_dump_list = info; + + + memset(&cb, 0, sizeof(cb)); + memset(&time, 0, sizeof(time)); + time.type = vpiSimTime; + + cb.time = &time; + cb.user_data = (char *) info; + + cb.value = &info->value; /* NC seems to be ok with NULL, but VCS needs &info->value */ + info->value.format = vpiObjTypeVal; + cb.obj = net; + cb.reason = cbValueChange; + cb.cb_rtn = variable_cb; + + vpi_free_object(vpi_register_cb(&cb)); + } + + return (0); +} + + +static int +draw_module(vpiHandle item, int typ) +{ + if (typ == vpiModule) { + draw_module_type(item, vpiNet); + } + draw_module_type(item, vpiReg); + draw_module_type(item, vpiVariables); + + return (0); +} + + +static int +draw_scope_fst(vpiHandle item, int depth, int depth_max) +{ + const char *fstscopnam; + char *defname = NULL; + vpiHandle orig = item; + + if ((depth_max) && (depth >= depth_max)) + return (0); + + if (depth == 0) { + int vpitype = vpi_get(vpiType, item); + int fsttype; + + int lineno = vpi_get(vpiLineNo, item); + const char *fname = vpi_get_str(vpiFile, item); + fstWriterSetSourceInstantiationStem(ctx, fname, lineno, 1); + + lineno = vpi_get(vpiDefLineNo, item); + fname = vpi_get_str(vpiDefFile, item); + fstWriterSetSourceStem(ctx, fname, lineno, 1); + + switch (vpitype) { + case vpiTaskFunc: + case vpiTask: + fsttype = FST_ST_VCD_TASK; + break; + case vpiFunction: + fsttype = FST_ST_VCD_FUNCTION; + break; + case vpiNamedBegin: + fsttype = FST_ST_VCD_BEGIN; + break; + case vpiNamedFork: + fsttype = FST_ST_VCD_FORK; + break; + case vpiModule: + default: + fsttype = FST_ST_VCD_MODULE; + defname = strdup(vpi_get_str(vpiDefName, item)); + break; + } + + fstscopnam = vpi_get_str(vpiName, item); + if(defname && !strcmp(defname, fstscopnam)) { free(defname); defname = NULL; } /* no sense in storing a duplicate name */ + fstWriterSetScope(ctx, fsttype, fstscopnam, defname); + if(defname) free(defname); + + draw_module(item, vpitype); + if (vpitype == vpiModule) { + draw_scope_fst(item, depth + 1, depth_max); + } + + fstWriterSetUpscope(ctx); + } else { + vpiHandle iter = vpi_iterate(vpiInternalScope, orig); + + if (iter) + while ((item = vpi_scan(iter))) { + int vpitype = vpi_get(vpiType, item); + int fsttype; + + int lineno = vpi_get(vpiLineNo, item); + const char *fname = vpi_get_str(vpiFile, item); + fstWriterSetSourceInstantiationStem(ctx, fname, lineno, 1); + + lineno = vpi_get(vpiDefLineNo, item); + fname = vpi_get_str(vpiDefFile, item); + fstWriterSetSourceStem(ctx, fname, lineno, 1); + + switch (vpitype) { + case vpiTaskFunc: + case vpiTask: + fsttype = FST_ST_VCD_TASK; + break; + case vpiFunction: + fsttype = FST_ST_VCD_FUNCTION; + break; + case vpiNamedBegin: + fsttype = FST_ST_VCD_BEGIN; + break; + case vpiNamedFork: + fsttype = FST_ST_VCD_FORK; + break; + case vpiModule: + default: + fsttype = FST_ST_VCD_MODULE; + defname = strdup(vpi_get_str(vpiDefName, item)); + break; + } + + + fstscopnam = vpi_get_str(vpiName, item); + if(defname && !strcmp(defname, fstscopnam)) { free(defname); defname = NULL; } /* no sense in storing a duplicate name */ + fstWriterSetScope(ctx, fsttype, fstscopnam, defname); + if(defname) free(defname); + + draw_module(item, vpitype); + + if (vpitype == vpiModule) { + draw_scope_fst(item, depth + 1, depth_max); + } + fstWriterSetUpscope(ctx); + } + } + + return (0); +} + + +/* + * This function is also used in sys_fst to check the arguments of the fst + * variant of $dumpvars. + */ +int +sys_dumpvars_compiletf(char *name) +{ + vpiHandle sys = vpi_handle(vpiSysTfCall, 0); + vpiHandle argv = vpi_iterate(vpiArgument, sys); + vpiHandle tmp; + + if (argv == 0) + return (0); + + tmp = vpi_scan(argv); + assert(tmp); + + switch (vpi_get(vpiType, tmp)) { + case vpiConstant: + if (vpi_get(vpiConstType, tmp) == vpiStringConst) { + vpi_printf("ERROR: %s argument must be " + "a number constant.\n", name); + vpi_control(vpiFinish, 1); + } + break; + + case vpiNet: + case vpiReg: + case vpiIntegerVar: + case vpiMemoryWord: + break; + + default: + vpi_printf("ERROR: %s argument must be " "a number constant.\n", + name); + vpi_control(vpiFinish, 1); + break; + } + + vpi_free_object(argv); + return (0); +} + + +int +sys_dumpvars_calltf(char *name) +{ + unsigned depth; + s_vpi_value value; + vpiHandle item = 0; + vpiHandle sys = vpi_handle(vpiSysTfCall, 0); + vpiHandle argv; + + if (ctx == 0) { + open_dumpfile(); + if (ctx == 0) + return (0); + } + if (install_dumpvars_callback()) { + return (0); + } + argv = vpi_iterate(vpiArgument, sys); + + depth = 0; + if (argv && (item = vpi_scan(argv))) + switch (vpi_get(vpiType, item)) { + case vpiConstant: + case vpiNet: + case vpiReg: + case vpiIntegerVar: + case vpiMemoryWord: + value.format = vpiIntVal; + vpi_get_value(item, &value); + depth = value.value.integer; + break; + } + + if (!argv) { + vpiHandle parent = vpi_handle(vpiScope, sys); + while (parent) { + item = parent; + parent = vpi_handle(vpiScope, item); + } + + } else if (!item || !(item = vpi_scan(argv))) { + item = vpi_handle(vpiScope, sys); + argv = 0x0; + } + for (; item; item = argv ? vpi_scan(argv) : 0x0) { + draw_scope_fst(item, 0, depth); + } + + + { + struct fst_info *a_info; + int prec = vpi_get(vpiTimePrecision, 0); + + fstWriterSetTimescale(ctx, prec); + fstWriterEmitTimeChange(ctx, 0); + + install_rosync_cb(); + } + + return (0); +} + + +int +sys_dumpoff_compiletf(char *name) +{ + return (0); +} + + +int +sys_dumpoff_calltf(char *name) +{ + dump_is_off = 1; + + return (0); +} + + +void +sys_fst_register() +{ + s_vpi_systf_data tf_data; + + tf_data.type = vpiSysTask; + tf_data.tfname = "$fstdumpfile"; + tf_data.calltf = sys_dumpfile_calltf; + tf_data.compiletf = sys_dumpfile_compiletf; + tf_data.sizetf = 0; + tf_data.user_data = "$fstdumpfile"; + vpi_register_systf(&tf_data); + + tf_data.type = vpiSysTask; + tf_data.tfname = "$fstdumpvars"; + tf_data.calltf = sys_dumpvars_calltf; + tf_data.compiletf = sys_dumpvars_compiletf; + tf_data.sizetf = 0; + tf_data.user_data = "$fstdumpvars"; + vpi_register_systf(&tf_data); + + tf_data.type = vpiSysTask; + tf_data.tfname = "$fstdumpoff"; + tf_data.calltf = sys_dumpoff_calltf; + tf_data.compiletf = sys_dumpoff_compiletf; + tf_data.sizetf = 0; + tf_data.user_data = "$fstdumpoff"; + vpi_register_systf(&tf_data); +} diff -Nru gtkwave-3.3.114/contrib/vpi/vpi_user.h gtkwave-3.3.118/contrib/vpi/vpi_user.h --- gtkwave-3.3.114/contrib/vpi/vpi_user.h 1970-01-01 00:00:00.000000000 +0000 +++ gtkwave-3.3.118/contrib/vpi/vpi_user.h 2023-12-31 21:11:03.000000000 +0000 @@ -0,0 +1,807 @@ +/*************************************************************************** +* vpi_user.h +* +* IEEE 1364-2000 Verilog HDL Programming Language Interface (PLI). +* +* This file contains the constant definitions, structure definitions, and +* routine declarations used by the Verilog PLI procedural interface VPI +* access routines. +* +**************************************************************************/ +/*************************************************************************** +* NOTE: the constant values 1 through 299 are reserved for use in this +* vpi_user.h file. +**************************************************************************/ +#ifndef VPI_USER_H +#define VPI_USER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*------------------------------------------------------------------------*/ +/*-------------------------- Portability Help ----------------------------*/ +/*------------------------------------------------------------------------*/ +/* Sized variables */ +#ifndef PLI_TYPES +#define PLI_TYPES +typedef int PLI_INT32; +typedef unsigned int PLI_UINT32; +typedef short PLI_INT16; +typedef unsigned short PLI_UINT16; +typedef char PLI_BYTE8; +typedef unsigned char PLI_UBYTE8; +#endif +/* Use to export a symbol */ +#if WIN32 +#ifndef PLI_DLLISPEC +#define PLI_DLLISPEC __declspec(dllimport) +#define VPI_USER_DEFINED_DLLISPEC 1 +#endif +#else +#ifndef PLI_DLLISPEC +#define PLI_DLLISPEC +#endif +#endif + +/* Use to import a symbol */ +#if WIN32 +#ifndef PLI_DLLESPEC +#define PLI_DLLESPEC __declspec(dllexport) +#define VPI_USER_DEFINED_DLLESPEC 1 +#endif +#else +#ifndef PLI_DLLESPEC +#define PLI_DLLESPEC +#endif +#endif + +/* Use to mark a function as external */ +#ifndef PLI_EXTERN +#define PLI_EXTERN +#endif +/* Use to mark a variable as external */ +#ifndef PLI_VEXTERN +#define PLI_VEXTERN extern +#endif +#ifndef PLI_PROTOTYPES +#define PLI_PROTOTYPES +#define PROTO_PARAMS(params) params +/* object is defined imported by the application */ +#define XXTERN PLI_EXTERN PLI_DLLISPEC +/* object is exported by the application */ +#define EETERN PLI_EXTERN PLI_DLLESPEC +#endif + +/******************************** TYPEDEFS ********************************/ +typedef PLI_UINT32 *vpiHandle; +/****************************** OBJECT TYPES ******************************/ +#define vpiAlways 1 /* always block */ +#define vpiAssignStmt 2 /* quasi-continuous assignment */ +#define vpiAssignment 3 /* procedural assignment */ +#define vpiBegin 4 /* block statement */ +#define vpiCase 5 /* case statement */ +#define vpiCaseItem 6 /* case statement item */ +#define vpiConstant 7 /* numerical constant or literal string */ +#define vpiContAssign 8 /* continuous assignment */ +#define vpiDeassign 9 /* deassignment statement */ +#define vpiDefParam 10 /* defparam */ +#define vpiDelayControl 11 /* delay statement (e.g. #10) */ +#define vpiDisable 12 /* named block disable statement */ +#define vpiEventControl 13 /* wait on event, e.g. @e */ +#define vpiEventStmt 14 /* event trigger, e.g. ->e */ +#define vpiFor 15 /* for statement */ +#define vpiForce 16 /* force statement */ +#define vpiForever 17 /* forever statement */ +#define vpiFork 18 /* fork-join block */ +#define vpiFuncCall 19 /* HDL function call */ +#define vpiFunction 20 /* HDL function */ +#define vpiGate 21 /* primitive gate */ +#define vpiIf 22 /* if statement */ +#define vpiIfElse 23 /* if-else statement */ +#define vpiInitial 24 /* initial block */ +#define vpiIntegerVar 25 /* integer variable */ +#define vpiInterModPath 26 /* intermodule wire delay */ +#define vpiIterator 27 /* iterator */ +#define vpiIODecl 28 /* input/output declaration */ +#define vpiMemory 29 /* behavioral memory */ +#define vpiMemoryWord 30 /* single word of memory */ +#define vpiModPath 31 /* module path for path delays */ +#define vpiModule 32 /* module instance */ +#define vpiNamedBegin 33 /* named block statement */ +#define vpiNamedEvent 34 /* event variable */ +#define vpiNamedFork 35 /* named fork-join block */ +#define vpiNet 36 /* scalar or vector net */ +#define vpiNetBit 37 /* bit of vector net */ +#define vpiNullStmt 38 /* a semicolon, Ie. #10 ; */ +#define vpiOperation 39 /* behavioral operation */ +#define vpiParamAssign 40 /* module parameter assignment */ +#define vpiParameter 41 /* module parameter */ +#define vpiPartSelect 42 /* part select */ +#define vpiPathTerm 43 /* terminal of module path */ +#define vpiPort 44 /* module port */ +#define vpiPortBit 45 /* bit of vector module port */ +#define vpiPrimTerm 46 /* primitive terminal */ +#define vpiRealVar 47 /* real variable */ +#define vpiReg 48 /* scalar or vector reg */ +#define vpiRegBit 49 /* bit of vector reg */ +#define vpiRelease 50 /* release statement */ +#define vpiRepeat 51 /* repeat statement */ +#define vpiRepeatControl 52 /* repeat control in an assign stmt */ +#define vpiSchedEvent 53 /* vpi_put_value() event */ +#define vpiSpecParam 54 /* specparam */ +#define vpiSwitch 55 /* transistor switch */ +#define vpiSysFuncCall 56 /* system function call */ +#define vpiSysTaskCall 57 /* system task call */ +#define vpiTableEntry 58 /* UDP state table entry */ +#define vpiTask 59 /* HDL task */ +#define vpiTaskCall 60 /* HDL task call */ +#define vpiTchk 61 /* timing check */ +#define vpiTchkTerm 62 /* terminal of timing check */ +#define vpiTimeVar 63 /* time variable */ +#define vpiTimeQueue 64 /* simulation event queue */ +#define vpiUdp 65 /* user-defined primitive */ +#define vpiUdpDefn 66 /* UDP definition */ +#define vpiUserSystf 67 /* user defined system task or function */ +#define vpiVarSelect 68 /* variable array selection */ +#define vpiWait 69 /* wait statement */ +#define vpiWhile 70 /* while statement */ + +/****************** object types added with 1364-2000 *********************/ +#define vpiAttribute 105 /* attribute of an object */ +#define vpiBitSelect 106 /* Bit select of parameter, var select */ +#define vpiCallback 107 /* callback object */ +#define vpiDelayTerm 108 /* Delay term which is a load or driver */ +#define vpiDelayDevice 109 /* Delay object within a net */ +#define vpiFrame 110 /* reentrant task/func frame */ +#define vpiGateArray 111 /* gate instance array */ +#define vpiModuleArray 112 /* module instance array */ +#define vpiPrimitiveArray 113 /* vpiprimitiveArray type */ +#define vpiNetArray 114 /* multidimensional net */ +#define vpiRange 115 /* range declaration */ +#define vpiRegArray 116 /* multidimensional reg */ +#define vpiSwitchArray 117 /* switch instance array */ +#define vpiUdpArray 118 /* UDP instance array */ +#define vpiContAssignBit 128 /* Bit of a vector continuous assignment */ +#define vpiNamedEventArray 129 /* multidimensional named event */ + +/******************************** METHODS *********************************/ +/************* methods used to traverse 1 to 1 relationships **************/ +#define vpiCondition 71 /* condition expression */ +#define vpiDelay 72 /* net or gate delay */ +#define vpiElseStmt 73 /* else statement */ +#define vpiForIncStmt 74 /* increment statement in for loop */ +#define vpiForInitStmt 75 /* initialization statement in for loop */ +#define vpiHighConn 76 /* higher connection to port */ +#define vpiLhs 77 /* left-hand side of assignment */ +#define vpiIndex 78 /* index of var select, bit select, etc. */ +#define vpiLeftRange 79 /* left range of vector or part select */ +#define vpiLowConn 80 /* lower connection to port */ +#define vpiParent 81 /* parent object */ +#define vpiRhs 82 /* right-hand side of assignment */ +#define vpiRightRange 83 /* right range of vector or part select */ +#define vpiScope 84 /* containing scope object */ +#define vpiSysTfCall 85 /* task function call */ +#define vpiTchkDataTerm 86 /* timing check data term */ +#define vpiTchkNotifier 87 /* timing check notifier */ +#define vpiTchkRefTerm 88 /* timing check reference term */ + +/************ methods used to traverse 1 to many relationships ************/ +#define vpiArgument 89 /* argument to (system) task/function */ +#define vpiBit 90 /* bit of vector net or port */ +#define vpiDriver 91 /* driver for a net */ +#define vpiInternalScope 92 /* internal scope in module */ +#define vpiLoad 93 /* load on net or reg */ +#define vpiModDataPathIn 94 /* data terminal of a module path */ +#define vpiModPathIn 95 /* Input terminal of a module path */ +#define vpiModPathOut 96 /* output terminal of a module path */ +#define vpiOperand 97 /* operand of expression */ +#define vpiPortInst 98 /* connected port instance */ +#define vpiProcess 99 /* process in module */ +#define vpiVariables 100 /* variables in module */ +#define vpiUse 101 /* usage */ + +/***** methods which can traverse 1 to 1, or 1 to many relationships ******/ +#define vpiExpr 102 /* connected expression */ +#define vpiPrimitive 103 /* primitive (gate, switch, UDP) */ +#define vpiStmt 104 /* statement in process or task */ + +/********************* methods added with 1364-2000 ***********************/ +#define vpiActiveTimeFormat 119 /* active $timeformat() system task */ +#define vpiInTerm 120 /* To get to a delay device's drivers. */ +#define vpiInstanceArray 121 /* vpiInstance arrays */ +#define vpiLocalDriver 122 /* local drivers (within a module */ +#define vpiLocalLoad 123 /* local loads (within a module */ +#define vpiOutTerm 124 /* To get to a delay device's loads. */ +#define vpiPorts 125 /* Module port */ +#define vpiSimNet 126 /* simulated net after collapsing */ +#define vpiTaskFunc 127 /* HDL task or function */ + +/******************************* PROPERTIES *******************************/ +/************************ generic object properties ***********************/ +#define vpiUndefined -1 /* undefined property */ +#define vpiType 1 /* type of object */ +#define vpiName 2 /* local name of object */ +#define vpiFullName 3 /* full hierarchical name */ +#define vpiSize 4 /* size of gate, net, port, etc. */ +#define vpiFile 5 /* File name in which the object is used */ +#define vpiLineNo 6 /* line number where the object is used */ + +/*************************** module properties ****************************/ +#define vpiTopModule 7 /* top-level module (boolean) */ +#define vpiCellInstance 8 /* cell (boolean) */ +#define vpiDefName 9 /* module definition name */ +#define vpiProtected 10 /* source protected module (boolean) */ +#define vpiTimeUnit 11 /* module time unit */ +#define vpiTimePrecision 12 /* module time precision */ +#define vpiDefNetType 13 /* default net type */ +#define vpiUnconnDrive 14 /* unconnected port drive strength */ +#define vpiHighZ 1 /* No default drive given */ +#define vpiPull1 2 /* default pull1 drive */ +#define vpiPull0 3 /* default pull0 drive */ +#define vpiDefFile 15 /* File name where the module is defined */ +#define vpiDefLineNo 16 /* line number for module definition */ +#define vpiDefDelayMode 47 /* Default delay mode for a module */ +#define vpiDelayModeNone 1 /* no delay mode specified */ +#define vpiDelayModePath 2 /* path delay mode */ +#define vpiDelayModeDistrib 3 /* distributed delay mode */ +#define vpiDelayModeUnit 4 /* unit delay mode */ +#define vpiDelayModeZero 5 /* zero delay mode */ +#define vpiDelayModeMTM 6 /* min:typ:max delay mode */ +#define vpiDefDecayTime 48 /* Default decay time for a module */ + +/************************ port and net properties *************************/ +#define vpiScalar 17 /* scalar (boolean) */ +#define vpiVector 18 /* vector (boolean) */ +#define vpiExplicitName 19 /* port is explicitly named */ +#define vpiDirection 20 /* direction of port: */ +#define vpiInput 1 /* input */ +#define vpiOutput 2 /* output */ +#define vpiInout 3 /* inout */ +#define vpiMixedIO 4 /* mixed input-output */ +#define vpiNoDirection 5 /* no direction */ +#define vpiConnByName 21 /* connected by name (boolean) */ +#define vpiNetType 22 /* net subtypes: */ +#define vpiWire 1 /* wire net */ +#define vpiWand 2 /* wire-and net */ +#define vpiWor 3 /* wire-or net */ +#define vpiTri 4 /* three-state net */ +#define vpiTri0 5 /* pull-down net */ +#define vpiTri1 6 /* pull-up net */ +#define vpiTriReg 7 /* tri state reg net */ +#define vpiTriAnd 8 /* three-state wire-and net */ +#define vpiTriOr 9 /* three-state wire-or net */ +#define vpiSupply1 10 /* supply 1 net */ +#define vpiSupply0 11 /* supply zero net */ +#define vpiNone 12 /* no default net type (1364-2000) */ +#define vpiExplicitScalared 23 /* explicitly scalared (boolean) */ +#define vpiExplicitVectored 24 /* explicitly vectored (boolean) */ +#define vpiExpanded 25 /* expanded vector net (boolean) */ +#define vpiImplicitDecl 26 /* implicitly declared net (boolean) */ +#define vpiChargeStrength 27 /* charge decay strength of net */ + +/* Defined as part of strengths section. +#define vpiLargeCharge 0x10 +#define vpiMediumCharge 0x04 +#define vpiSmallCharge 0x02 +*/ + +#define vpiArray 28 /* variable array (boolean) */ +#define vpiPortIndex 29 /* Port index */ +/********************** gate and terminal properties **********************/ +#define vpiTermIndex 30 /* Index of a primitive terminal */ +#define vpiStrength0 31 /* 0-strength of net or gate */ +#define vpiStrength1 32 /* 1-strength of net or gate */ +#define vpiPrimType 33 /* prmitive subtypes: */ +#define vpiAndPrim 1 /* and gate */ +#define vpiNandPrim 2 /* nand gate */ +#define vpiNorPrim 3 /* nor gate */ +#define vpiOrPrim 4 /* or gate */ +#define vpiXorPrim 5 /* xor gate */ +#define vpiXnorPrim 6 /* xnor gate */ +#define vpiBufPrim 7 /* buffer */ +#define vpiNotPrim 8 /* not gate */ +#define vpiBufif0Prim 9 /* zero-enabled buffer */ +#define vpiBufif1Prim 10 /* one-enabled buffer */ +#define vpiNotif0Prim 11 /* zero-enabled not gate */ +#define vpiNotif1Prim 12 /* one-enabled not gate */ +#define vpiNmosPrim 13 /* nmos switch */ +#define vpiPmosPrim 14 /* pmos switch */ +#define vpiCmosPrim 15 /* cmos switch */ +#define vpiRnmosPrim 16 /* resistive nmos switch */ +#define vpiRpmosPrim 17 /* resistive pmos switch */ +#define vpiRcmosPrim 18 /* resistive cmos switch */ +#define vpiRtranPrim 19 /* resistive bidirectional */ +#define vpiRtranif0Prim 20 /* zero-enable resistive bidirectional */ +#define vpiRtranif1Prim 21 /* one-enable resistive bidirectional */ +#define vpiTranPrim 22 /* bidirectional */ +#define vpiTranif0Prim 23 /* zero-enabled bidirectional */ +#define vpiTranif1Prim 24 /* one-enabled bidirectional */ +#define vpiPullupPrim 25 /* pullup */ +#define vpiPulldownPrim 26 /* pulldown */ +#define vpiSeqPrim 27 /* sequential UDP */ +#define vpiCombPrim 28 /* combinational UDP */ + +/************** path, path terminal, timing check properties **************/ +#define vpiPolarity 34 /* polarity of module path... */ +#define vpiDataPolarity 35 /* ...or data path: */ +#define vpiPositive 1 /* positive */ +#define vpiNegative 2 /* negative */ +#define vpiUnknown 3 /* unknown (unspecified) */ +#define vpiEdge 36 /* edge type of module path: */ +#define vpiNoEdge 0x00000000 /* no edge */ +#define vpiEdge01 0x00000001 /* 0 -> 1 */ +#define vpiEdge10 0x00000002 /* 1 -> 0 */ +#define vpiEdge0x 0x00000004 /* 0 -> x */ +#define vpiEdgex1 0x00000008 /* x -> 1 */ +#define vpiEdge1x 0x00000010 /* 1 -> x */ +#define vpiEdgex0 0x00000020 /* x -> 0 */ +#define vpiPosEdge (vpiEdgex1 | vpiEdge01 | vpiEdge0x) +#define vpiNegEdge (vpiEdgex0 | vpiEdge10 | vpiEdge1x) +#define vpiAnyEdge (vpiPosEdge | vpiNegEdge) + +#define vpiPathType 37 /* path delay connection subtypes: */ +#define vpiPathFull 1 /* ( a *> b ) */ +#define vpiPathParallel 2 /* ( a => b ) */ +#define vpiTchkType 38 /* timing check subtypes: */ +#define vpiSetup 1 /* $setup */ +#define vpiHold 2 /* $hold */ +#define vpiPeriod 3 /* $period */ +#define vpiWidth 4 /* $width */ +#define vpiSkew 5 /* $skew */ +#define vpiRecovery 6 /* $recovery */ +#define vpiNoChange 7 /* $nochange */ +#define vpiSetupHold 8 /* $setuphold */ +#define vpiFullskew 9 /* $fullskew -- added for 1364-2000 */ +#define vpiRecrem 10 /* $recrem -- added for 1364-2000 */ +#define vpiRemoval 11 /* $removal -- added for 1364-2000 */ +#define vpiTimeskew 12 /* $timeskew -- added for 1364-2000 */ + +/************************* expression properties **************************/ +#define vpiOpType 39 /* operation subtypes: */ +#define vpiMinusOp 1 /* unary minus */ +#define vpiPlusOp 2 /* unary plus */ +#define vpiNotOp 3 /* unary not */ +#define vpiBitNegOp 4 /* bitwise negation */ +#define vpiUnaryAndOp 5 /* bitwise reduction and */ +#define vpiUnaryNandOp 6 /* bitwise reduction nand */ +#define vpiUnaryOrOp 7 /* bitwise reduction or */ +#define vpiUnaryNorOp 8 /* bitwise reduction nor */ +#define vpiUnaryXorOp 9 /* bitwise reduction xor */ +#define vpiUnaryXNorOp 10 /* bitwise reduction xnor */ +#define vpiSubOp 11 /* binary subtraction */ +#define vpiDivOp 12 /* binary division */ +#define vpiModOp 13 /* binary modulus */ +#define vpiEqOp 14 /* binary equality */ +#define vpiNeqOp 15 /* binary inequality */ +#define vpiCaseEqOp 16 /* case (x and z) equality */ +#define vpiCaseNeqOp 17 /* case inequality */ +#define vpiGtOp 18 /* binary greater than */ +#define vpiGeOp 19 /* binary greater than or equal */ +#define vpiLtOp 20 /* binary less than */ +#define vpiLeOp 21 /* binary less than or equal */ +#define vpiLShiftOp 22 /* binary left shift */ +#define vpiRShiftOp 23 /* binary right shift */ +#define vpiAddOp 24 /* binary addition */ +#define vpiMultOp 25 /* binary multiplication */ +#define vpiLogAndOp 26 /* binary logical and */ +#define vpiLogOrOp 27 /* binary logical or */ +#define vpiBitAndOp 28 /* binary bitwise and */ +#define vpiBitOrOp 29 /* binary bitwise or */ +#define vpiBitXorOp 30 /* binary bitwise xor */ +#define vpiBitXNorOp 31 /* binary bitwise xnor */ +#define vpiBitXnorOp vpiBitXNorOp /* added with 1364-2000 */ +#define vpiConditionOp 32 /* ternary conditional */ +#define vpiConcatOp 33 /* n-ary concatenation */ +#define vpiMultiConcatOp 34 /* repeated concatenation */ +#define vpiEventOrOp 35 /* event or */ +#define vpiNullOp 36 /* null operation */ +#define vpiListOp 37 /* list of expressions */ +#define vpiMinTypMaxOp 38 /* min:typ:max: delay expression */ +#define vpiPosedgeOp 39 /* posedge */ +#define vpiNegedgeOp 40 /* negedge */ +#define vpiArithLShiftOp 41 /* arithmetic left shift (1364-2000) */ +#define vpiArithRShiftOp 42 /* arithmetic right shift (1364-2000) */ +#define vpiPowerOp 43 /* arithmetic power op (1364-2000) */ + +#define vpiConstType 40 /* constant subtypes: */ +#define vpiDecConst 1 /* decimal integer */ +#define vpiRealConst 2 /* real */ +#define vpiBinaryConst 3 /* binary integer */ +#define vpiOctConst 4 /* octal integer */ +#define vpiHexConst 5 /* hexadecimal integer */ +#define vpiStringConst 6 /* string literal */ +#define vpiIntConst 7 /* HDL integer constant (1364-2000) */ +#define vpiBlocking 41 /* blocking assignment (boolean) */ +#define vpiCaseType 42 /* case statement subtypes: */ +#define vpiCaseExact 1 /* exact match */ +#define vpiCaseX 2 /* ignore X's */ +#define vpiCaseZ 3 /* ignore Z's */ +#define vpiNetDeclAssign 43 /* assign part of decl (boolean) */ + +/************** task/function properties **************/ +#define vpiFuncType 44 /* HDL function and system function type */ +#define vpiIntFunc 1 /* returns integer */ +#define vpiRealFunc 2 /* returns real */ +#define vpiTimeFunc 3 /* returns time */ +#define vpiSizedFunc 4 /* returns an arbitrary size */ +#define vpiSizedSignedFunc 5 /* returns sized signed value */ + +/* alias 1364-1995 system function subtypes to 1364-2000 function subtypes */ +#define vpiSysFuncType vpiFuncType +#define vpiSysFuncInt vpiIntFunc +#define vpiSysFuncReal vpiRealFunc +#define vpiSysFuncTime vpiTimeFunc +#define vpiSysFuncSized vpiSizedFunc +#define vpiUserDefn 45 /* user defined system task/func (boolean) */ +#define vpiScheduled 46 /* object still scheduled (boolean) */ + +/*********************** properties added with 1364-2000 *******************/ +#define vpiActive 49 /* reentrant task/func frame is active */ +#define vpiAutomatic 50 /* task/func obj is automatic */ +#define vpiCell 51 /* configuration cell */ +#define vpiConfig 52 /* configuration config file */ +#define vpiConstantSelect 53 /* (boolean) bit or part select indices +are constant expressions */ +#define vpiDecompile 54 /* decompile the object */ +#define vpiDefAttribute 55 /* Attribute defined for the obj */ +#define vpiDelayType 56 /* delay subtype */ +#define vpiModPathDelay 1 /* module path delay */ +#define vpiInterModPathDelay 2 /* intermodule path delay */ +#define vpiMIPDelay 3 /* module input port delay */ +#define vpiIteratorType 57 /* object type of an iterator */ +#define vpiLibrary 58 /* configuration library */ +#define vpiMultiArray 59 /* Object is a multidimensional array */ +#define vpiOffset 60 /* offset from LSB */ +#define vpiResolvedNetType 61 /* net subtype after resolution, returns + same subtypes as vpiNetType */ +#define vpiSaveRestartID 62 /* unique ID for save/restart data */ +#define vpiSaveRestartLocation 63 /* name of save/restart data file */ +#define vpiValid 64 /* reentrant task/func frame is valid */ +#define vpiSigned 65 /* TRUE for vpiIODecl and any object in + the expression class if the object + has the signed attribute */ +#define vpiLocalParam 70 /* TRUE when a param is declared as a + localparam */ +#define vpiModPathHasIfNone 71 /* Mod path has an ifnone statement */ + +/************* vpi_control() constants (added with 1364-2000) *************/ +#define vpiStop 66 /* execute simulator's $stop */ +#define vpiFinish 67 /* execute simulator's $finish */ +#define vpiReset 68 /* execute simulator's $reset */ +#define vpiSetInteractiveScope 69 /* set simulator's interactive scope */ + +/************************** I/O related defines ***************************/ +#define VPI_MCD_STDOUT 0x00000001 + +/************************** STRUCTURE DEFINITIONS *************************/ +/***************************** time structure *****************************/ +typedef struct t_vpi_time +{ + PLI_INT32 type; /* [vpiScaledRealTime, vpiSimTime, vpiSuppressTime] */ + PLI_UINT32 high, low; /* for vpiSimTime */ + double real; /* for vpiScaledRealTime */ +} s_vpi_time, *p_vpi_time; + +/* time types */ +#define vpiScaledRealTime 1 +#define vpiSimTime 2 +#define vpiSuppressTime 3 + +/**************************** delay structures ****************************/ +typedef struct t_vpi_delay +{ + struct t_vpi_time *da; /* pointer to user allocated array of delay values */ + PLI_INT32 no_of_delays; /* number of delays */ + PLI_INT32 time_type; /* [vpiScaledRealTime, vpiSimTime, vpiSuppressTime] */ + PLI_INT32 mtm_flag; /* true for mtm values */ + PLI_INT32 append_flag; /* true for append */ + PLI_INT32 pulsere_flag; /* true for pulsere values */ +} s_vpi_delay, *p_vpi_delay; + +/**************************** value structures ****************************/ +/* vector value */ +typedef struct t_vpi_vecval +{ + /* following fields are repeated enough times to contain vector */ + PLI_INT32 aval, bval; /* bit encoding: ab: 00=0, 10=1, 11=X, 01=Z */ +} s_vpi_vecval, *p_vpi_vecval; + +/* strength (scalar) value */ +typedef struct t_vpi_strengthval +{ + PLI_INT32 logic; /* vpi[0,1,X,Z] */ + PLI_INT32 s0, s1; /* refer to strength coding below */ +} s_vpi_strengthval, *p_vpi_strengthval; + +/* strength values */ +#define vpiSupplyDrive 0x80 +#define vpiStrongDrive 0x40 +#define vpiPullDrive 0x20 +#define vpiWeakDrive 0x08 +#define vpiLargeCharge 0x10 +#define vpiMediumCharge 0x04 +#define vpiSmallCharge 0x02 +#define vpiHiZ 0x01 + +/* generic value */ +typedef struct t_vpi_value +{ + PLI_INT32 format; /* vpi[[Bin,Oct,Dec,Hex]Str,Scalar,Int,Real,String, + Vector,Strength,Suppress,Time,ObjType]Val */ + union + { + PLI_BYTE8 *str; /* string value */ + PLI_INT32 scalar; /* vpi[0,1,X,Z] */ + PLI_INT32 integer; /* integer value */ + double real; /* real value */ + struct t_vpi_time *time; /* time value */ + struct t_vpi_vecval *vector; /* vector value */ + struct t_vpi_strengthval *strength; /* strength value */ + PLI_BYTE8 *misc; /* ...other */ + } value; +} s_vpi_value, *p_vpi_value; + +/* value formats */ +#define vpiBinStrVal 1 +#define vpiOctStrVal 2 +#define vpiDecStrVal 3 +#define vpiHexStrVal 4 +#define vpiScalarVal 5 +#define vpiIntVal 6 +#define vpiRealVal 7 +#define vpiStringVal 8 +#define vpiVectorVal 9 +#define vpiStrengthVal 10 +#define vpiTimeVal 11 +#define vpiObjTypeVal 12 +#define vpiSuppressVal 13 + +/* delay modes */ +#define vpiNoDelay 1 +#define vpiInertialDelay 2 +#define vpiTransportDelay 3 +#define vpiPureTransportDelay 4 + +/* force and release flags */ +#define vpiForceFlag 5 +#define vpiReleaseFlag 6 + +/* scheduled event cancel flag */ +#define vpiCancelEvent 7 + +/* bit mask for the flags argument to vpi_put_value() */ +#define vpiReturnEvent 0x1000 + +/* scalar values */ +#define vpi0 0 +#define vpi1 1 +#define vpiZ 2 +#define vpiX 3 +#define vpiH 4 +#define vpiL 5 +#define vpiDontCare 6 + +/* +#define vpiNoChange 7 Defined under vpiTchkType, but +can be used here. +*/ +/********************* system task/function structure *********************/ +typedef struct t_vpi_systf_data +{ + PLI_INT32 type; /* vpiSysTask, vpiSysFunc */ + PLI_INT32 sysfunctype; /* vpiSysTask, vpi[Int,Real,Time,Sized, + SizedSigned] Func */ + PLI_BYTE8 *tfname; /* first character must be `$' */ + PLI_INT32 (*calltf)(); + PLI_INT32 (*compiletf)(); + PLI_INT32 (*sizetf)(); /* for sized function callbacks only */ + PLI_BYTE8 *user_data; +} s_vpi_systf_data, *p_vpi_systf_data; + +#define vpiSysTask 1 +#define vpiSysFunc 2 +/* the subtypes are defined under the vpiFuncType property */ + +/***************** Verilog execution information structure ****************/ +typedef struct t_vpi_vlog_info +{ + PLI_INT32 argc; + PLI_BYTE8 **argv; + PLI_BYTE8 *product; + PLI_BYTE8 *version; +} s_vpi_vlog_info, *p_vpi_vlog_info; + +/******************** PLI error information structure *********************/ +typedef struct t_vpi_error_info +{ + PLI_INT32 state; /* vpi[Compile,PLI,Run] */ + PLI_INT32 level; /* vpi[Notice,Warning,Error,System,Internal] */ + PLI_BYTE8 *message; + PLI_BYTE8 *product; + PLI_BYTE8 *code; + PLI_BYTE8 *file; + PLI_INT32 line; +} s_vpi_error_info, *p_vpi_error_info; + + +/* error types */ +#define vpiCompile 1 +#define vpiPLI 2 +#define vpiRun 3 + +#define vpiNotice 1 +#define vpiWarning 2 +#define vpiError 3 +#define vpiSystem 4 +#define vpiInternal 5 + +/************************** callback structures ***************************/ +/* normal callback structure */ +typedef struct t_cb_data +{ + PLI_INT32 reason; /* callback reason */ + PLI_INT32 (*cb_rtn)(struct t_cb_data *); /* call routine */ + vpiHandle obj; /* trigger object */ + p_vpi_time time; /* callback time */ + p_vpi_value value; /* trigger object value */ + PLI_INT32 index; /* index of the memory word or var select that changed */ + PLI_BYTE8 *user_data; +} s_cb_data, *p_cb_data; + +/**************************** CALLBACK REASONS ****************************/ +/*************************** Simulation related ***************************/ +#define cbValueChange 1 +#define cbStmt 2 +#define cbForce 3 +#define cbRelease 4 + +/****************************** Time related ******************************/ +#define cbAtStartOfSimTime 5 +#define cbReadWriteSynch 6 +#define cbReadOnlySynch 7 +#define cbNextSimTime 8 +#define cbAfterDelay 9 + +/***************************** Action related *****************************/ +#define cbEndOfCompile 10 +#define cbStartOfSimulation 11 +#define cbEndOfSimulation 12 +#define cbError 13 +#define cbTchkViolation 14 +#define cbStartOfSave 15 +#define cbEndOfSave 16 +#define cbStartOfRestart 17 +#define cbEndOfRestart 18 +#define cbStartOfReset 19 +#define cbEndOfReset 20 +#define cbEnterInteractive 21 +#define cbExitInteractive 22 +#define cbInteractiveScopeChange 23 +#define cbUnresolvedSystf 24 + +/************************** Added with 1364-2000 **************************/ +#define cbAssign 25 +#define cbDeassign 26 +#define cbDisable 27 +#define cbPLIError 28 +#define cbSignal 29 + +/************************* FUNCTION DECLARATIONS **************************/ +/* callback related */ +XXTERN vpiHandle vpi_register_cb PROTO_PARAMS((p_cb_data cb_data_p)); +XXTERN PLI_INT32 vpi_remove_cb PROTO_PARAMS((vpiHandle cb_obj)); +XXTERN void vpi_get_cb_info PROTO_PARAMS((vpiHandle object, + p_cb_data cb_data_p)); +XXTERN vpiHandle vpi_register_systf PROTO_PARAMS((p_vpi_systf_data + systf_data_p)); +XXTERN void vpi_get_systf_info PROTO_PARAMS((vpiHandle object, + p_vpi_systf_data systf_data_p)); +/* for obtaining handles */ +XXTERN vpiHandle vpi_handle_by_name PROTO_PARAMS((PLI_BYTE8 *name, + vpiHandle scope)); +XXTERN vpiHandle vpi_handle_by_index PROTO_PARAMS((vpiHandle object, + PLI_INT32 indx)); + +/* for traversing relationships */ +XXTERN vpiHandle vpi_handle PROTO_PARAMS((PLI_INT32 type, + vpiHandle refHandle)); +XXTERN vpiHandle vpi_handle_multi PROTO_PARAMS((PLI_INT32 type, + vpiHandle refHandle1, + vpiHandle refHandle2, ... )); +XXTERN vpiHandle vpi_iterate PROTO_PARAMS((PLI_INT32 type, + vpiHandle refHandle)); +XXTERN vpiHandle vpi_scan PROTO_PARAMS((vpiHandle iterator)); + +/* for processing properties */ +XXTERN PLI_INT32 vpi_get PROTO_PARAMS((PLI_INT32 property, + vpiHandle object)); + +XXTERN PLI_BYTE8 *vpi_get_str PROTO_PARAMS((PLI_INT32 property, + vpiHandle object)); +/* delay processing */ +XXTERN void vpi_get_delays PROTO_PARAMS((vpiHandle object, + p_vpi_delay delay_p)); +XXTERN void vpi_put_delays PROTO_PARAMS((vpiHandle object, + p_vpi_delay delay_p)); + +/* value processing */ +XXTERN void vpi_get_value PROTO_PARAMS((vpiHandle expr, p_vpi_value value_p)); +XXTERN vpiHandle vpi_put_value PROTO_PARAMS((vpiHandle object, + p_vpi_value value_p, + p_vpi_time time_p, + PLI_INT32 flags)); + +/* time processing */ +XXTERN void vpi_get_time PROTO_PARAMS((vpiHandle object, + p_vpi_time time_p)); + +/* I/O routines */ +XXTERN PLI_UINT32 vpi_mcd_open PROTO_PARAMS((PLI_BYTE8 *fileName)); +XXTERN PLI_UINT32 vpi_mcd_close PROTO_PARAMS((PLI_UINT32 mcd)); +XXTERN PLI_BYTE8 *vpi_mcd_name PROTO_PARAMS((PLI_UINT32 cd)); +XXTERN PLI_INT32 vpi_mcd_printf PROTO_PARAMS((PLI_UINT32 mcd, + PLI_BYTE8 *format, ...)); + +XXTERN PLI_INT32 vpi_printf PROTO_PARAMS((PLI_BYTE8 *format, + ...)); +/* utility routines */ +XXTERN PLI_INT32 vpi_compare_objects PROTO_PARAMS((vpiHandle object1, + vpiHandle object2)); +XXTERN PLI_INT32 vpi_chk_error PROTO_PARAMS((p_vpi_error_info + error_info_p)); +XXTERN PLI_INT32 vpi_free_object PROTO_PARAMS((vpiHandle object)); +XXTERN PLI_INT32 vpi_get_vlog_info PROTO_PARAMS((p_vpi_vlog_info + vlog_info_p)); + +/* routines added with 1364-2000 */ +XXTERN PLI_INT32 vpi_get_data PROTO_PARAMS((PLI_INT32 id, + PLI_BYTE8 *dataLoc, + PLI_INT32 numOfBytes)); +XXTERN PLI_INT32 vpi_put_data PROTO_PARAMS((PLI_INT32 id, + PLI_BYTE8 *dataLoc, + PLI_INT32 numOfBytes)); +XXTERN void *vpi_get_userdata PROTO_PARAMS((vpiHandle obj)); +XXTERN PLI_INT32 vpi_put_userdata PROTO_PARAMS((vpiHandle obj, + void *userdata)); +XXTERN PLI_INT32 vpi_vprintf PROTO_PARAMS((PLI_BYTE8 *format, + va_list ap)); +XXTERN PLI_INT32 vpi_mcd_vprintf PROTO_PARAMS((PLI_UINT32 mcd, + PLI_BYTE8 *format, va_list ap)); +XXTERN PLI_INT32 vpi_flush PROTO_PARAMS((void)); +XXTERN PLI_INT32 vpi_mcd_flush PROTO_PARAMS((PLI_UINT32 mcd)); +XXTERN PLI_INT32 vpi_control PROTO_PARAMS((PLI_INT32 operation, +...)); +XXTERN vpiHandle vpi_handle_by_multi_index PROTO_PARAMS((vpiHandle obj, +PLI_INT32 num_index, +PLI_INT32 *index_array)); + +/**************************** GLOBAL VARIABLES ****************************/ +PLI_VEXTERN PLI_DLLESPEC void (*vlog_startup_routines[])(); +/* array of function pointers, last pointer should be null */ +#undef PLI_EXTERN +#undef PLI_VEXTERN +#ifdef VPI_USER_DEFINED_DLLISPEC +#undef VPI_USER_DEFINED_DLLISPEC +#undef PLI_DLLISPEC +#endif +#ifdef VPI_USER_DEFINED_DLLESPEC +#undef VPI_USER_DEFINED_DLLESPEC +IEEE +HARDWARE DESCRIPTION LANGUAGE Std 1364-2001 +#undef PLI_DLLESPEC +#endif +#ifdef PLI_PROTOTYPES +#undef PLI_PROTOTYPES +#undef PROTO_PARAMS +#undef XXTERN +#undef EETERN +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* VPI_USER_H */ diff -Nru gtkwave-3.3.114/contrib/xml2stems/xml2stems.cc gtkwave-3.3.118/contrib/xml2stems/xml2stems.cc --- gtkwave-3.3.114/contrib/xml2stems/xml2stems.cc 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/contrib/xml2stems/xml2stems.cc 2023-12-31 21:11:03.000000000 +0000 @@ -138,6 +138,9 @@ { const char *nam = (*xmt)[string("name")].c_str(); const char *fl = (*xmt)[string("fl")].c_str(); + const char *loc = (*xmt)[string("loc")].c_str(); + int loc_offset = 0; + if(!fl || !strlen(fl)) { fl = loc; loc_offset = 1; } if(!oneline) { @@ -148,7 +151,8 @@ const char *s = fl; char *d = fl_dup; while(isalpha(*s)) { *(d++) = *(s++); } *d = 0; - + + s+=loc_offset; unsigned int lineno = atoi(s); const char *mnam = fId[fl_dup].c_str(); @@ -194,6 +198,9 @@ const char *fl = (*xmt)[string("fl")].c_str(); const char *nam = (*xmt)[string("name")].c_str(); const char *tms = (*xmt)[string("topModule")].c_str(); + const char *loc = (*xmt)[string("loc")].c_str(); + int loc_offset = 0; + if(!fl || !strlen(fl)) { fl = loc; loc_offset = 1; } if(fl && nam && tms) { @@ -205,7 +212,8 @@ const char *s = fl; char *d = fl_dup; while(isalpha(*s)) { *(d++) = *(s++); } *d = 0; - + + s += loc_offset; unsigned int lineno = atoi(s); const char *mnam = fId[fl_dup].c_str(); fprintf(fo, "++ module %s file %s lines %d - %d\n", nam, mnam, lineno, lineno); /* don't need line number it truly ends at */ @@ -233,7 +241,7 @@ func_nesting_cnt = (!endtag) ? (func_nesting_cnt+1) : (func_nesting_cnt-1); } else - if(!strncmp(pnt, "files", 5)) + if((!strncmp(pnt, "files", 5)) || (!strncmp(pnt, "module_files", 12))) { in_files = (!endtag); } @@ -293,7 +301,10 @@ { const char *fl = (*xmt)[string("fl")].c_str(); const char *nam = (*xmt)[string("name")].c_str(); - + const char *loc = (*xmt)[string("loc")].c_str(); + int loc_offset = 0; + if(!fl || !strlen(fl)) { fl = loc; loc_offset = 1; } + if(fl && nam) { mId.push(nam); @@ -303,6 +314,7 @@ while(isalpha(*s)) { *(d++) = *(s++); } *d = 0; + s += loc_offset; unsigned int lineno = atoi(s); const char *mnam = fId[fl_dup].c_str(); fprintf(fo, "++ udp %s file %s lines %d - %d\n", nam, mnam, lineno, lineno); /* don't need line number it truly ends at */ diff -Nru gtkwave-3.3.114/debian/changelog gtkwave-3.3.118/debian/changelog --- gtkwave-3.3.114/debian/changelog 2023-01-20 03:01:31.000000000 +0000 +++ gtkwave-3.3.118/debian/changelog 2024-03-28 06:53:47.000000000 +0000 @@ -1,3 +1,58 @@ +gtkwave (3.3.118-0.1~deb12u1) bookworm-security; urgency=medium + + * Non-maintainer upload. + * Rebuild for bookworm-security. + + -- Adrian Bunk Thu, 28 Mar 2024 08:53:47 +0200 + +gtkwave (3.3.118-0.1) unstable; urgency=high + + * Non-maintainer upload. + * New upstream release. + - Fixes multiple vulnerabilities: + CVE-2023-32650, CVE-2023-34087, CVE-2023-34436, CVE-2023-35004, + CVE-2023-35057, CVE-2023-35128, CVE-2023-35702, CVE-2023-35703, + CVE-2023-35704, CVE-2023-35955, CVE-2023-35956, CVE-2023-35957, + CVE-2023-35958, CVE-2023-35959, CVE-2023-35960, CVE-2023-35961, + CVE-2023-35962, CVE-2023-35963, CVE-2023-35964, CVE-2023-35969, + CVE-2023-35970, CVE-2023-35989, CVE-2023-35992, CVE-2023-35994, + CVE-2023-35995, CVE-2023-35996, CVE-2023-35997, CVE-2023-36746, + CVE-2023-36747, CVE-2023-36861, CVE-2023-36864, CVE-2023-36915, + CVE-2023-36916, CVE-2023-37282, CVE-2023-37416, CVE-2023-37417, + CVE-2023-37418, CVE-2023-37419, CVE-2023-37420, CVE-2023-37442, + CVE-2023-37443, CVE-2023-37444, CVE-2023-37445, CVE-2023-37446, + CVE-2023-37447, CVE-2023-37573, CVE-2023-37574, CVE-2023-37575, + CVE-2023-37576, CVE-2023-37577, CVE-2023-37578, CVE-2023-37921, + CVE-2023-37922, CVE-2023-37923, CVE-2023-38583, CVE-2023-38618, + CVE-2023-38619, CVE-2023-38620, CVE-2023-38621, CVE-2023-38622, + CVE-2023-38623, CVE-2023-38648, CVE-2023-38649, CVE-2023-38650, + CVE-2023-38651, CVE-2023-38652, CVE-2023-38653, CVE-2023-38657, + CVE-2023-39234, CVE-2023-39235, CVE-2023-39270, CVE-2023-39271, + CVE-2023-39272, CVE-2023-39273, CVE-2023-39274, CVE-2023-39275, + CVE-2023-39316, CVE-2023-39317, CVE-2023-39413, CVE-2023-39414, + CVE-2023-39443, CVE-2023-39444 + (Closes: #1060407) + + -- Adrian Bunk Sat, 23 Mar 2024 21:54:30 +0200 + +gtkwave (3.3.116-1) unstable; urgency=medium + + * New upstream version 3.3.116 + + -- أحمد المحمودي (Ahmed El-Mahmoudy) Sat, 29 Jul 2023 05:35:40 +0200 + +gtkwave (3.3.115-1) unstable; urgency=medium + + * New upstream version 3.3.115 + * d/watch: update watch format version + * d/u/metadata: remove Homepage field + * d/p/0001-Add-F-to-exec-key-in-desktop-file.patch: forward upstream & add + DEP-3 headers + * Add autotools-pkg-config.diff patch to use PKG_PROG_PKG_CONFIG instead of + AC_PATH_CONFIG + + -- أحمد المحمودي (Ahmed El-Mahmoudy) Mon, 05 Jun 2023 00:01:50 +0200 + gtkwave (3.3.114-2) unstable; urgency=medium * Upload to unstable diff -Nru gtkwave-3.3.114/debian/patches/0001-Add-F-to-exec-key-in-desktop-file.patch gtkwave-3.3.118/debian/patches/0001-Add-F-to-exec-key-in-desktop-file.patch --- gtkwave-3.3.114/debian/patches/0001-Add-F-to-exec-key-in-desktop-file.patch 2023-01-12 01:13:54.000000000 +0000 +++ gtkwave-3.3.118/debian/patches/0001-Add-F-to-exec-key-in-desktop-file.patch 2023-07-29 03:35:40.000000000 +0000 @@ -1,6 +1,6 @@ -From: "Dr. Tobias Quathamer" -Date: Sat, 1 Jul 2017 16:21:47 +0200 -Subject: Add %F to exec key in desktop file +Description: Add %F to exec key in desktop file +Author: "Dr. Tobias Quathamer" +Forwarded: https://github.com/gtkwave/gtkwave/pull/205 --- share/applications/gtkwave.desktop | 3 +-- diff -Nru gtkwave-3.3.114/debian/patches/autotools-pkg-config.diff gtkwave-3.3.118/debian/patches/autotools-pkg-config.diff --- gtkwave-3.3.114/debian/patches/autotools-pkg-config.diff 1970-01-01 00:00:00.000000000 +0000 +++ gtkwave-3.3.118/debian/patches/autotools-pkg-config.diff 2023-07-29 03:35:40.000000000 +0000 @@ -0,0 +1,26 @@ +Description: Use PKG_PROG_PKG_CONFIG instead of AC_PATH_CONFIG +Author: أحمد المحمودي (Ahmed El-Mahmoudy) +Forwarded: https://github.com/gtkwave/gtkwave/pull/206 + +Index: gtkwave/configure.ac +=================================================================== +--- gtkwave.orig/configure.ac 2023-06-04 22:39:26.741992895 +0200 ++++ gtkwave/configure.ac 2023-06-04 23:29:54.030424581 +0200 +@@ -606,7 +606,7 @@ + # ------------- GTK ------------------- + if test "X$GTK3" = "Xyes" ; then + +- AC_PATH_PROG(PKG_CONFIG, [pkg-config], [notfound]) ++ PKG_PROG_PKG_CONFIG() + PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0.0) + GTK_VER=`$PKG_CONFIG gtk+-3.0 --modversion` + +@@ -642,7 +642,7 @@ + + else + +- AC_PATH_PROG(PKG_CONFIG, [pkg-config], [notfound]) ++ PKG_PROG_PKG_CONFIG() + PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.24.9) + GTK_VER=`$PKG_CONFIG gtk+-2.0 --modversion` + diff -Nru gtkwave-3.3.114/debian/patches/series gtkwave-3.3.118/debian/patches/series --- gtkwave-3.3.114/debian/patches/series 2023-01-12 01:13:54.000000000 +0000 +++ gtkwave-3.3.118/debian/patches/series 2023-07-29 03:35:40.000000000 +0000 @@ -1,2 +1,3 @@ +autotools-pkg-config.diff 0001-Add-F-to-exec-key-in-desktop-file.patch gcc10-extern.patch diff -Nru gtkwave-3.3.114/debian/upstream/metadata gtkwave-3.3.118/debian/upstream/metadata --- gtkwave-3.3.114/debian/upstream/metadata 2023-01-12 01:13:54.000000000 +0000 +++ gtkwave-3.3.118/debian/upstream/metadata 2023-07-29 03:35:40.000000000 +0000 @@ -1,7 +1,6 @@ Bug-Database: https://github.com/gtkwave/gtkwave/issues Bug-Submit: https://github.com/gtkwave/gtkwave/issues/new Contact: bybell@rocketmail.com -Homepage: http://gtkwave.sourceforge.net/ Repository: svn://svn.code.sf.net/p/gtkwave/code/ Repository-Browse: http://sourceforge.net/p/gtkwave/code/HEAD/tree/ Screenshots: https://a.fsdn.com/con/app/proj/gtkwave/screenshots/100573.jpg diff -Nru gtkwave-3.3.114/debian/watch gtkwave-3.3.118/debian/watch --- gtkwave-3.3.114/debian/watch 2023-01-20 01:44:12.000000000 +0000 +++ gtkwave-3.3.118/debian/watch 2023-07-29 03:35:40.000000000 +0000 @@ -1,2 +1,2 @@ -version=3 +version=4 http://sf.net/gtkwave/gtkwave-gtk3-([0-9.]+)\.tar\.gz diff -Nru gtkwave-3.3.114/distro_from_svn.sh gtkwave-3.3.118/distro_from_svn.sh --- gtkwave-3.3.114/distro_from_svn.sh 1970-01-01 00:00:00.000000000 +0000 +++ gtkwave-3.3.118/distro_from_svn.sh 2023-12-31 21:11:03.000000000 +0000 @@ -0,0 +1,10 @@ +#!/bin/sh +echo "Cleaning out SVN directories..." +find . | grep '\.svn' | tac | awk '{print "rm -rf "$0}' | sh + +echo "Making distribution tarball from SVN directory..." +cd ../ +cat ./gtkwave3-gtk3/configure.ac | grep AC_INIT | awk '{print $2}' | sed 's/,//' | \ + awk '{print "mv gtkwave3-gtk3 gtkwave-gtk3-"$0" ; tar cvf gtkwave-gtk3-"$0".tar gtkwave-gtk3-"$0" ; gzip -9 gtkwave-gtk3-"$0".tar"}' | sh + +echo "Done!" diff -Nru gtkwave-3.3.114/man/vcd2fst.1 gtkwave-3.3.118/man/vcd2fst.1 --- gtkwave-3.3.114/man/vcd2fst.1 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/man/vcd2fst.1 2023-12-31 21:11:03.000000000 +0000 @@ -24,7 +24,7 @@ \fB\-F,\-\-fastpack\fR Indicates that fastlz should be used instead of LZ4 for value change data. .TP -\fB\-4,\-\-zlibpack\fR +\fB\-Z,\-\-zlibpack\fR Indicates that zlib should be used instead of LZ4 for value change data. .TP \fB\-c,\-\-compress\fR diff -Nru gtkwave-3.3.114/share/appdata/Makefile.am gtkwave-3.3.118/share/appdata/Makefile.am --- gtkwave-3.3.114/share/appdata/Makefile.am 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/share/appdata/Makefile.am 2023-12-31 21:11:03.000000000 +0000 @@ -1,4 +1,4 @@ ## -*- makefile -*- ## -EXTRA_DIST= gtkwave.appdata.xml +EXTRA_DIST= io.github.gtkwave.GTKWave.metainfo.xml diff -Nru gtkwave-3.3.114/share/appdata/Makefile.in gtkwave-3.3.118/share/appdata/Makefile.in --- gtkwave-3.3.114/share/appdata/Makefile.in 2022-11-23 05:58:00.000000000 +0000 +++ gtkwave-3.3.118/share/appdata/Makefile.in 2023-12-31 21:11:03.000000000 +0000 @@ -261,7 +261,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXTRA_DIST = gtkwave.appdata.xml +EXTRA_DIST = io.github.gtkwave.GTKWave.metainfo.xml all: all-am .SUFFIXES: diff -Nru gtkwave-3.3.114/share/appdata/gtkwave.appdata.xml gtkwave-3.3.118/share/appdata/gtkwave.appdata.xml --- gtkwave-3.3.114/share/appdata/gtkwave.appdata.xml 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/share/appdata/gtkwave.appdata.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - -gtkwave.desktop -CC0-1.0 -Electronic waveform viewer for viewing simulation results - -

-GTKWave is a fully featured GTK+ based waveform viewer which reads FST, LXT, LXT2, VZT, and GHW files as well as standard Verilog VCD/EVCD files and allows their viewing. -

-

-The viewer supports both post-mortem viewing of VCD files and interactive viewing of VCD data. Tcl scripting and callback capability allow for remote control by other applications. -

-
-http://gtkwave.sourceforge.net/ - -http://gtkwave.sourceforge.net/gtkwave-appdata.png - -bybell@rocketmail.com -
diff -Nru gtkwave-3.3.114/share/appdata/io.github.gtkwave.GTKWave.metainfo.xml gtkwave-3.3.118/share/appdata/io.github.gtkwave.GTKWave.metainfo.xml --- gtkwave-3.3.114/share/appdata/io.github.gtkwave.GTKWave.metainfo.xml 1970-01-01 00:00:00.000000000 +0000 +++ gtkwave-3.3.118/share/appdata/io.github.gtkwave.GTKWave.metainfo.xml 2023-12-31 21:11:03.000000000 +0000 @@ -0,0 +1,143 @@ + + + + io.github.gtkwave.GTKWave + CC0-1.0 + GPL-2.0-or-later + GTKWave + Tony Bybell + bybell@rocketmail.com + Electronic waveform viewer for viewing simulation results + +

+ GTKWave is a fully featured GTK+ based waveform viewer which reads FST and + GHW files as well as standard Verilog VCD/EVCD files and allows their viewing. +

+

+ The viewer supports both post-mortem viewing of VCD files and interactive viewing of VCD data. + Tcl scripting and callback capability allow for remote control by other applications. +

+
+ + http://gtkwave.sourceforge.net/ + https://github.com/gtkwave/gtkwave/issues + https://github.com/gtkwave/gtkwave + + + + http://gtkwave.sourceforge.net/gtkwave-appdata.png + + + + + + + + +

+ Changes in 3.3.118: +

+
    +
  • Update xml2stems to handle newer "loc" vs "fl" xml tags
  • +
  • Change preg_regex_c_1 decl to use regex_t* as datatype
  • +
  • Move gtkwave.appdata.xml to io.github.gtkwave.GTKWave.metainfo.xml
  • +
+
+
+ + + +

+ Changes in 3.3.117: +

+
    +
  • Fix stems reader processing code broken in 3.3.114
  • +
+
+
+ + + +

+ Changes in 3.3.116: +

+
    +
  • Fix manpage/odt for vcd2fst command switch documentation for zlibpack
  • +
  • Add GDK_WINDOWING_WAYLAND check for gdkwayland.h header usage
  • +
  • Changed sprintf to snprintf in fstapi.c
  • +
  • Fix init crash on show_base_symbols enabled
  • +
+
+
+ + + +

+ Changes in 3.3.115: +

+
    +
  • Fix VZT reader with -fstrict-aliasing
  • +
  • Fix use_multi_state condition in vzt_write.c
  • +
  • Fix for UNDEF vs strings at start of a vzt file
  • +
  • Fix sleep() time scaling redefine for mingw
  • +
  • Use MapViewOfFileEx for mmap on Windows (fstapi)
  • +
  • Define FST_DO_MISALIGNED_OPS on AArch64 (fstapi)
  • +
  • Fixed attrbegin short length problem
  • +
+
+
+ + + +

+ Changes in 3.3.114: +

+
    +
  • Buffer overflow fixes in FST reader
  • +
+
+
+ + + +

+ Changes in 3.3.113: +

+
    +
  • High CPU utilization when nothing is happening
  • +
+
+
+ + + +

+ Changes in 3.3.112: +

+
    +
  • Bugfix-only release, no feature adds
  • +
  • VCD reader fixes for unnamed Icarus begin blocks
  • +
  • String data type crash fix in fst.c
  • +
+
+
+ + + +

+ Changes in 3.3.111: +

+
    +
  • Rendering fix for filled rectangles and line caps in Cairo
  • +
  • Fix in fstapi for read start limit time
  • +
  • Use GtkSearchEntry in SST
  • +
  • Convert entrybox to use dialog box
  • +
  • Entrybox: use default response instead of signal handler
  • +
  • Updated show-change widget
  • +
  • Fix xml2stems when begin blocks are in functions
  • +
  • Skip over decimal point in timescale in viewer
  • +
+
+
+
+
diff -Nru gtkwave-3.3.114/src/debug.c gtkwave-3.3.118/src/debug.c --- gtkwave-3.3.114/src/debug.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/debug.c 2023-12-31 21:11:04.000000000 +0000 @@ -736,3 +736,42 @@ return(w); } + +/******************************************************/ + +FILE *popen_san(const char *command, const char *type) /* TALOS-2023-1786 */ +{ +const char *p = command; +int is_ok = 1; +char ch; + +while(p && (ch = *(p++))) + { + switch(ch) + { + case '&': + case '|': + case ';': + case '\n': + case '`': + case '$': + is_ok = 0; + + default: + break; + } + } + +if(is_ok) + { + return(popen(command, type)); + } +else + { + fprintf(stderr, "GTKWAVE | TALOS-2023-1786: popen() command string '%s' may not be properly sanitized, blocking command.\n", command); + errno = EPIPE; + return(NULL); + } +} + +/******************************************************/ diff -Nru gtkwave-3.3.114/src/debug.h gtkwave-3.3.118/src/debug.h --- gtkwave-3.3.114/src/debug.h 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/debug.h 2023-12-31 21:11:04.000000000 +0000 @@ -187,5 +187,6 @@ GtkWidget *X_gtk_entry_new_with_max_length (gint max); -#endif +FILE *popen_san(const char *command, const char *type); /* TALOS-2023-1786 */ +#endif diff -Nru gtkwave-3.3.114/src/extload.c gtkwave-3.3.118/src/extload.c --- gtkwave-3.3.114/src/extload.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/extload.c 2023-12-31 21:11:04.000000000 +0000 @@ -1693,7 +1693,7 @@ last_modification_check(); sprintf(sbuff, "%s -info %s 2>&1", EXTLOAD_PATH, fname); -GLOBALS->extload = popen(sbuff, "r"); +GLOBALS->extload = popen_san(sbuff, "r"); for(;;) { char * rc = fgets(sbuff, 65536, GLOBALS->extload); @@ -1898,7 +1898,7 @@ if(!last_modification_check()) { GLOBALS->extload_already_errored = 1; return(LLDescriptor(0)); } sprintf(sbuff, "%s -hier_tree %s 2>&1", EXTLOAD_PATH, fname); -GLOBALS->extload = popen(sbuff, "r"); +GLOBALS->extload = popen_san(sbuff, "r"); /* do your stuff here..all useful info has been initialized by now */ @@ -2254,7 +2254,7 @@ TimeType tim; sprintf(sbuff, "%s -vc -vidcode %d %s 2>&1", EXTLOAD_PATH, txidx_in_trace, GLOBALS->loaded_file_name); - GLOBALS->extload = popen(sbuff, "r"); + GLOBALS->extload = popen_san(sbuff, "r"); for(;;) { diff -Nru gtkwave-3.3.114/src/globals.c gtkwave-3.3.118/src/globals.c --- gtkwave-3.3.114/src/globals.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/globals.c 2023-12-31 21:11:04.000000000 +0000 @@ -50,7 +50,7 @@ #include "fsdb_wrapper_api.h" #ifdef __MINGW32__ -#define sleep(x) Sleep(x) +#define sleep(x) Sleep(x * 1000) #endif #if !defined __MINGW32__ diff -Nru gtkwave-3.3.114/src/globals.h gtkwave-3.3.118/src/globals.h --- gtkwave-3.3.114/src/globals.h 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/globals.h 2023-12-31 21:11:04.000000000 +0000 @@ -766,7 +766,7 @@ /* * regex.c */ -struct re_pattern_buffer *preg_regex_c_1; /* from regex.c 339 */ +regex_t *preg_regex_c_1; /* from regex.c 339 */ int *regex_ok_regex_c_1; /* from regex.c 340 */ diff -Nru gtkwave-3.3.114/src/gtk23compat.h gtkwave-3.3.118/src/gtk23compat.h --- gtkwave-3.3.114/src/gtk23compat.h 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/gtk23compat.h 2023-12-31 21:11:04.000000000 +0000 @@ -8,7 +8,7 @@ #endif #if GTK_CHECK_VERSION(3,22,26) -#if !defined(__MINGW32__) && !defined(MAC_INTEGRATION) +#if !defined(__MINGW32__) && !defined(MAC_INTEGRATION) && defined(GDK_WINDOWING_WAYLAND) #include #endif #endif diff -Nru gtkwave-3.3.114/src/helpers/evcd2vcd.c gtkwave-3.3.118/src/helpers/evcd2vcd.c --- gtkwave-3.3.114/src/helpers/evcd2vcd.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/evcd2vcd.c 2023-12-31 21:11:04.000000000 +0000 @@ -37,6 +37,16 @@ #endif #include +/* + * report abort messages + */ +static void chk_report_abort(const char *s) +{ +fprintf(stderr,"Triggered %s security check, exiting.\n", s); +abort(); +} + + ssize_t getline_replace(char **buf, size_t *len, FILE *f) { char *fgets_rc; @@ -234,6 +244,10 @@ if(!node) { Jval val; + if((len < 0) || (len > 32768)) + { + chk_report_abort("TALOS-2023-1803"); + } jrb_insert_int(vcd_ids, hash, val)->val2.i = len; } diff -Nru gtkwave-3.3.114/src/helpers/fst/fstapi.c gtkwave-3.3.118/src/helpers/fst/fstapi.c --- gtkwave-3.3.114/src/helpers/fst/fstapi.c 2022-11-23 05:56:49.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/fst/fstapi.c 2023-12-31 21:11:04.000000000 +0000 @@ -58,6 +58,7 @@ #endif #ifdef __MINGW32__ +#define WIN32_LEAN_AND_MEAN #include #endif @@ -131,7 +132,7 @@ #define FST_GZIO_LEN (32768) #define FST_HDR_FOURPACK_DUO_SIZE (4*1024*1024) -#if defined(__i386__) || defined(__x86_64__) || defined(_AIX) +#if defined(__i386__) || defined(__x86_64__) || defined(_AIX) || defined(__aarch64__) #define FST_DO_MISALIGNED_OPS #endif @@ -192,6 +193,16 @@ /* + * report abort messages + */ +static void chk_report_abort(const char *s) +{ +fprintf(stderr,"Triggered %s security check, exiting.\n", s); +abort(); +} + + +/* * prevent old file overwrite when currently being read */ static FILE *unlink_fopen(const char *nam, const char *mode) @@ -334,26 +345,22 @@ /* * mmap compatibility */ -#if defined __CYGWIN__ || defined __MINGW32__ +#if defined __MINGW32__ #include #define fstMmap(__addr,__len,__prot,__flags,__fd,__off) fstMmap2((__len), (__fd), (__off)) -#define fstMunmap(__addr,__len) free(__addr) +#define fstMunmap(__addr,__len) UnmapViewOfFile((LPCVOID)__addr) static void *fstMmap2(size_t __len, int __fd, fst_off_t __off) { -(void)__off; - -unsigned char *pnt = (unsigned char *)malloc(__len); -fst_off_t cur_offs = lseek(__fd, 0, SEEK_CUR); -size_t i; - -lseek(__fd, 0, SEEK_SET); -for(i=0;i<__len;i+=SSIZE_MAX) - { - read(__fd, pnt + i, ((__len - i) >= SSIZE_MAX) ? SSIZE_MAX : (__len - i)); - } -lseek(__fd, cur_offs, SEEK_SET); -return(pnt); +HANDLE handle = CreateFileMapping((HANDLE)_get_osfhandle(__fd), NULL, + PAGE_READWRITE, (DWORD)(__len >> 32), + (DWORD)__len, NULL); +if (!handle) { return NULL; } + +void *ptr = MapViewOfFileEx(handle, FILE_MAP_READ | FILE_MAP_WRITE, + 0, (DWORD)__off, (SIZE_T)__len, (LPVOID)NULL); +CloseHandle(handle); +return ptr; } #else #include @@ -553,7 +560,8 @@ static uint32_t fstReaderVarint32(FILE *f) { -unsigned char buf[5]; +int chk_len = 5; /* TALOS-2023-1783 */ +unsigned char buf[chk_len]; unsigned char *mem = buf; uint32_t rc = 0; int ch; @@ -562,7 +570,9 @@ { ch = fgetc(f); *(mem++) = ch; - } while(ch & 0x80); + } while((ch & 0x80) && (--chk_len)); + +if(ch & 0x80) chk_report_abort("TALOS-2023-1783"); mem--; for(;;) @@ -582,7 +592,8 @@ static uint32_t fstReaderVarint32WithSkip(FILE *f, uint32_t *skiplen) { -unsigned char buf[5]; +int chk_len = 5; /* TALOS-2023-1783 */ +unsigned char buf[chk_len]; unsigned char *mem = buf; uint32_t rc = 0; int ch; @@ -591,7 +602,9 @@ { ch = fgetc(f); *(mem++) = ch; - } while(ch & 0x80); + } while((ch & 0x80) && (--chk_len)); + +if(ch & 0x80) chk_report_abort("TALOS-2023-1783"); *skiplen = mem - buf; mem--; @@ -612,7 +625,8 @@ static uint64_t fstReaderVarint64(FILE *f) { -unsigned char buf[16]; +int chk_len = 16; /* TALOS-2023-1783 */ +unsigned char buf[chk_len]; unsigned char *mem = buf; uint64_t rc = 0; int ch; @@ -621,9 +635,12 @@ { ch = fgetc(f); *(mem++) = ch; - } while(ch & 0x80); + } while((ch & 0x80) && (--chk_len)); + +if(ch & 0x80) chk_report_abort("TALOS-2023-1783"); mem--; + for(;;) { rc <<= 7; @@ -984,14 +1001,26 @@ */ static void fstWriterMmapSanity(void *pnt, const char *file, int line, const char *usage) { -#if !defined(__CYGWIN__) && !defined(__MINGW32__) -if(pnt == MAP_FAILED) +if(pnt == NULL +#ifdef MAP_FAILED + || pnt == MAP_FAILED +#endif + ) { fprintf(stderr, "fstMmap() assigned to %s failed: errno: %d, file %s, line %d.\n", usage, errno, file, line); +#if !defined(__MINGW32__) perror("Why"); +#else + LPSTR mbuf = NULL; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&mbuf, 0, NULL); + fprintf(stderr, "%s", mbuf); + LocalFree(mbuf); +#endif pnt = NULL; } -#endif } @@ -1037,34 +1066,11 @@ static void fstDestroyMmaps(struct fstWriterContext *xc, int is_closing) { -#if !defined __CYGWIN__ && !defined __MINGW32__ (void)is_closing; -#endif fstMunmap(xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t)); xc->valpos_mem = NULL; -#if defined __CYGWIN__ || defined __MINGW32__ -if(xc->curval_mem) - { - if(!is_closing) /* need to flush out for next emulated mmap() read */ - { - unsigned char *pnt = xc->curval_mem; - int __fd = fileno(xc->curval_handle); - fst_off_t cur_offs = lseek(__fd, 0, SEEK_CUR); - size_t i; - size_t __len = xc->maxvalpos; - - lseek(__fd, 0, SEEK_SET); - for(i=0;i<__len;i+=SSIZE_MAX) - { - write(__fd, pnt + i, ((__len - i) >= SSIZE_MAX) ? SSIZE_MAX : (__len - i)); - } - lseek(__fd, cur_offs, SEEK_SET); - } - } -#endif - fstMunmap(xc->curval_mem, xc->maxvalpos); xc->curval_mem = NULL; } @@ -1852,6 +1858,14 @@ xc->xc_parent = xc; memcpy(xc2, xc, sizeof(struct fstWriterContext)); + if(sizeof(size_t) < sizeof(uint64_t)) + { + /* TALOS-2023-1777 for 32b overflow */ + uint64_t chk_64 = xc->maxhandle * 4 * sizeof(uint32_t); + size_t chk_32 = xc->maxhandle * 4 * sizeof(uint32_t); + if(chk_64 != chk_32) chk_report_abort("TALOS-2023-1777"); + } + xc2->valpos_mem = (uint32_t *)malloc(xc->maxhandle * 4 * sizeof(uint32_t)); memcpy(xc2->valpos_mem, xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t)); @@ -2066,7 +2080,8 @@ int zfd; int fourpack_duo = 0; #ifndef __MINGW32__ - char *fnam = (char *)malloc(strlen(xc->filename) + 5 + 1); + int fnam_len = strlen(xc->filename) + 5 + 1; + char *fnam = (char *)malloc(fnam_len); #endif fixup_offs = ftello(xc->handle); @@ -2156,7 +2171,7 @@ fflush(xc->handle); #ifndef __MINGW32__ - sprintf(fnam, "%s.hier", xc->filename); + snprintf(fnam, fnam_len, "%s.hier", xc->filename); unlink(fnam); free(fnam); #endif @@ -2835,7 +2850,7 @@ uint32_t i; name_len = strlen(name); - elem_count_len = sprintf(elem_count_buf, "%" PRIu32, elem_count); + elem_count_len = snprintf(elem_count_buf, 16, "%" PRIu32, elem_count); literal_lens = (unsigned int *)calloc(elem_count, sizeof(unsigned int)); val_lens = (unsigned int *)calloc(elem_count, sizeof(unsigned int)); @@ -3412,6 +3427,7 @@ unsigned do_rewind : 1; char str_scope_nam[FST_ID_NAM_SIZ+1]; char str_scope_comp[FST_ID_NAM_SIZ+1]; +char *str_scope_attr; unsigned fseek_failed : 1; @@ -3446,7 +3462,7 @@ #ifndef FST_WRITEX_DISABLE -static void fstWritex(struct fstReaderContext *xc, void *v, int len) +static void fstWritex(struct fstReaderContext *xc, void *v, uint32_t len) /* TALOS-2023-1793: change len to unsigned */ { unsigned char *s = (unsigned char *)v; @@ -3922,7 +3938,8 @@ if(!xc->fh) { fst_off_t offs_cache = ftello(xc->f); - char *fnam = (char *)malloc(strlen(xc->filename) + 6 + 16 + 32 + 1); + int fnam_len = strlen(xc->filename) + 6 + 16 + 32 + 1; + char *fnam = (char *)malloc(fnam_len); unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN); fst_off_t hl, uclen; fst_off_t clen = 0; @@ -3941,7 +3958,7 @@ htyp = xc->contains_hier_section_lz4duo ? FST_BL_HIER_LZ4DUO : FST_BL_HIER_LZ4; } - sprintf(fnam, "%s.hier_%d_%p", xc->filename, getpid(), (void *)xc); + snprintf(fnam, fnam_len, "%s.hier_%d_%p", xc->filename, getpid(), (void *)xc); fstReaderFseeko(xc, xc->f, xc->hier_pos, SEEK_SET); uclen = fstReaderUint64(xc->f); #ifndef __MINGW32__ @@ -4140,7 +4157,7 @@ cl = 0; while((ch = fgetc(xc->fh))) { - if(cl <= FST_ID_NAM_SIZ) + if(cl < FST_ID_NAM_SIZ) { pnt[cl++] = ch; } @@ -4152,7 +4169,7 @@ cl = 0; while((ch = fgetc(xc->fh))) { - if(cl <= FST_ID_NAM_SIZ) + if(cl < FST_ID_NAM_SIZ) { pnt[cl++] = ch; } @@ -4169,15 +4186,19 @@ xc->hier.htyp = FST_HT_ATTRBEGIN; xc->hier.u.attr.typ = fgetc(xc->fh); xc->hier.u.attr.subtype = fgetc(xc->fh); - xc->hier.u.attr.name = pnt = xc->str_scope_nam; + if(!xc->str_scope_attr) + { + xc->str_scope_attr = (char *)calloc(1, FST_ID_NAM_ATTR_SIZ+1); + } + xc->hier.u.attr.name = pnt = xc->str_scope_attr; cl = 0; while((ch = fgetc(xc->fh))) { - if(cl <= FST_ID_NAM_SIZ) + if(cl < FST_ID_NAM_ATTR_SIZ) { pnt[cl++] = ch; } - }; /* scopename */ + }; /* attrname */ pnt[cl] = 0; xc->hier.u.attr.name_length = cl; @@ -4188,7 +4209,7 @@ if((xc->hier.u.attr.subtype == FST_MT_SOURCESTEM)||(xc->hier.u.attr.subtype == FST_MT_SOURCEISTEM)) { int sidx_skiplen_dummy = 0; - xc->hier.u.attr.arg_from_name = fstGetVarint64((unsigned char *)xc->str_scope_nam, &sidx_skiplen_dummy); + xc->hier.u.attr.arg_from_name = fstGetVarint64((unsigned char *)xc->str_scope_attr, &sidx_skiplen_dummy); } } break; @@ -4237,7 +4258,7 @@ cl = 0; while((ch = fgetc(xc->fh))) { - if(cl <= FST_ID_NAM_SIZ) + if(cl < FST_ID_NAM_SIZ) { pnt[cl++] = ch; } @@ -4376,7 +4397,7 @@ cl = 0; while((ch = fgetc(xc->fh))) { - if(cl <= FST_ID_NAM_ATTR_SIZ) + if(cl < FST_ID_NAM_ATTR_SIZ) { pnt[cl++] = ch; } @@ -4398,7 +4419,7 @@ cl = 0; while((ch = fgetc(xc->fh))) { - if(cl <= FST_ID_NAM_ATTR_SIZ) + if(cl < FST_ID_NAM_ATTR_SIZ) { pnt[cl++] = ch; } @@ -4487,7 +4508,7 @@ cl = 0; while((ch = fgetc(xc->fh))) { - if(cl <= FST_ID_NAM_ATTR_SIZ) + if(cl < FST_ID_NAM_ATTR_SIZ) { pnt[cl++] = ch; } @@ -4594,15 +4615,17 @@ int zfd; int flen = strlen(xc->filename); char *hf; + int hf_len; seclen = fstReaderUint64(xc->f); uclen = fstReaderUint64(xc->f); if(!seclen) return(0); /* not finished compressing, this is a failed read */ - hf = (char *)calloc(1, flen + 16 + 32 + 1); + hf_len = flen + 16 + 32 + 1; + hf = (char *)calloc(1, hf_len); - sprintf(hf, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc); + snprintf(hf, hf_len, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc); fcomp = fopen(hf, "w+b"); if(!fcomp) { @@ -4974,6 +4997,7 @@ free(xc->signal_typs); xc->signal_typs = NULL; free(xc->signal_lens); xc->signal_lens = NULL; free(xc->filename); xc->filename = NULL; + free(xc->str_scope_attr); xc->str_scope_attr = NULL; if(xc->fh) { @@ -5064,6 +5088,7 @@ for(;;) { uint32_t *tc_head = NULL; + uint32_t tc_head_items = 0; traversal_mem_offs = 0; fstReaderFseeko(xc, xc->f, blkpos, SEEK_SET); @@ -5107,12 +5132,12 @@ } - mem_required_for_traversal = fstReaderUint64(xc->f); - mem_for_traversal = (unsigned char *)malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */ + mem_required_for_traversal = fstReaderUint64(xc->f) + 66; /* add in potential fastlz overhead */ + mem_for_traversal = (unsigned char *)malloc(mem_required_for_traversal); #ifdef FST_DEBUG fprintf(stderr, FST_APIMESS "sec: %u seclen: %d begtim: %d endtim: %d\n", secnum, (int)seclen, (int)beg_tim, (int)end_tim); - fprintf(stderr, FST_APIMESS "mem_required_for_traversal: %d\n", (int)mem_required_for_traversal); + fprintf(stderr, FST_APIMESS "mem_required_for_traversal: %d\n", (int)mem_required_for_traversal-66); #endif /* process time block */ { @@ -5162,6 +5187,22 @@ } free(time_table); + + if(sizeof(size_t) < sizeof(uint64_t)) + { + /* TALOS-2023-1792 for 32b overflow */ + uint64_t chk_64 = tsec_nitems * sizeof(uint64_t); + size_t chk_32 = ((size_t)tsec_nitems) * sizeof(uint64_t); + if(chk_64 != chk_32) chk_report_abort("TALOS-2023-1792"); + } + else + { + uint64_t chk_64 = tsec_nitems * sizeof(uint64_t); + if((chk_64/sizeof(uint64_t)) != tsec_nitems) + { + chk_report_abort("TALOS-2023-1792"); + } + } time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t)); tpnt = ucdata; tpval = 0; @@ -5173,7 +5214,23 @@ tpnt += skiplen; } - tc_head = (uint32_t *)calloc(tsec_nitems /* scan-build */ ? tsec_nitems : 1, sizeof(uint32_t)); + tc_head_items = tsec_nitems /* scan-build */ ? tsec_nitems : 1; + if(sizeof(size_t) < sizeof(uint64_t)) + { + /* TALOS-2023-1792 for 32b overflow */ + uint64_t chk_64 = tc_head_items * sizeof(uint32_t); + size_t chk_32 = ((size_t)tc_head_items) * sizeof(uint32_t); + if(chk_64 != chk_32) chk_report_abort("TALOS-2023-1792"); + } + else + { + uint64_t chk_64 = tc_head_items * sizeof(uint32_t); + if((chk_64/sizeof(uint32_t)) != tc_head_items) + { + chk_report_abort("TALOS-2023-1792"); + } + } + tc_head = (uint32_t *)calloc(tc_head_items, sizeof(uint32_t)); free(ucdata); } @@ -5197,16 +5254,16 @@ if(beg_tim) { - if(dumpvars_state == 1) { wx_len = sprintf(wx_buf, "$end\n"); fstWritex(xc, wx_buf, wx_len); dumpvars_state = 2; } - wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", beg_tim); + if(dumpvars_state == 1) { wx_len = snprintf(wx_buf, 32, "$end\n"); fstWritex(xc, wx_buf, wx_len); dumpvars_state = 2; } + wx_len = snprintf(wx_buf, 32, "#%" PRIu64 "\n", beg_tim); fstWritex(xc, wx_buf, wx_len); - if(!dumpvars_state) { wx_len = sprintf(wx_buf, "$dumpvars\n"); fstWritex(xc, wx_buf, wx_len); dumpvars_state = 1; } + if(!dumpvars_state) { wx_len = snprintf(wx_buf, 32, "$dumpvars\n"); fstWritex(xc, wx_buf, wx_len); dumpvars_state = 1; } } if((xc->num_blackouts)&&(cur_blackout != xc->num_blackouts)) { if(beg_tim == xc->blackout_times[cur_blackout]) { - wx_len = sprintf(wx_buf, "$dump%s $end\n", (xc->blackout_activity[cur_blackout++]) ? "on" : "off"); + wx_len = snprintf(wx_buf, 32, "$dump%s $end\n", (xc->blackout_activity[cur_blackout++]) ? "on" : "off"); fstWritex(xc, wx_buf, wx_len); } } @@ -5277,6 +5334,10 @@ { if(value_change_callback) { + if(xc->signal_lens[idx] > xc->longest_signal_value_len) + { + chk_report_abort("TALOS-2023-1797"); + } memcpy(xc->temp_signal_value_buf, mu+sig_offs, xc->signal_lens[idx]); xc->temp_signal_value_buf[xc->signal_lens[idx]] = 0; value_change_callback(user_callback_data_pointer, beg_tim, idx+1, xc->temp_signal_value_buf); @@ -5290,6 +5351,10 @@ vcd_id[0] = (xc->signal_typs[idx] != FST_VT_VCD_PORT) ? 'b' : 'p'; fstWritex(xc, vcd_id, 1); + if((sig_offs + xc->signal_lens[idx]) > frame_uclen) + { + chk_report_abort("TALOS-2023-1793"); + } fstWritex(xc,mu+sig_offs, xc->signal_lens[idx]); vcd_id[0] = ' '; /* collapse 3 writes into one I/O call */ @@ -5340,7 +5405,7 @@ clone_d[j] = srcdata[7-j]; } } - sprintf((char *)xc->temp_signal_value_buf, "%.16g", d); + snprintf((char *)xc->temp_signal_value_buf, xc->longest_signal_value_len + 1, "%.16g", d); value_change_callback(user_callback_data_pointer, beg_tim, idx+1, xc->temp_signal_value_buf); } } @@ -5368,7 +5433,7 @@ } fstVcdID(vcdid_buf, idx+1); - wx_len = sprintf(wx_buf, "r%.16g %s\n", d, vcdid_buf); + wx_len = snprintf(wx_buf, 64, "r%.16g %s\n", d, vcdid_buf); fstWritex(xc, wx_buf, wx_len); } } @@ -5414,7 +5479,44 @@ free(chain_table_lengths); vc_maxhandle_largest = vc_maxhandle; + + if(!(vc_maxhandle+1)) + { + chk_report_abort("TALOS-2023-1798"); + } + + if(sizeof(size_t) < sizeof(uint64_t)) + { + /* TALOS-2023-1798 for 32b overflow */ + uint64_t chk_64 = (vc_maxhandle+1) * sizeof(fst_off_t); + size_t chk_32 = ((size_t)(vc_maxhandle+1)) * sizeof(fst_off_t); + if(chk_64 != chk_32) chk_report_abort("TALOS-2023-1798"); + } + else + { + uint64_t chk_64 = (vc_maxhandle+1) * sizeof(fst_off_t); + if((chk_64/sizeof(fst_off_t)) != (vc_maxhandle+1)) + { + chk_report_abort("TALOS-2023-1798"); + } + } chain_table = (fst_off_t *)calloc((vc_maxhandle+1), sizeof(fst_off_t)); + + if(sizeof(size_t) < sizeof(uint64_t)) + { + /* TALOS-2023-1798 for 32b overflow */ + uint64_t chk_64 = (vc_maxhandle+1) * sizeof(uint32_t); + size_t chk_32 = ((size_t)(vc_maxhandle+1)) * sizeof(uint32_t); + if(chk_64 != chk_32) chk_report_abort("TALOS-2023-1798"); + } + else + { + uint64_t chk_64 = (vc_maxhandle+1) * sizeof(uint32_t); + if((chk_64/sizeof(uint32_t)) != (vc_maxhandle+1)) + { + chk_report_abort("TALOS-2023-1798"); + } + } chain_table_lengths = (uint32_t *)calloc((vc_maxhandle+1), sizeof(uint32_t)); } @@ -5458,6 +5560,11 @@ uint64_t val = fstGetVarint32(pnt, &skiplen); fstHandle loopcnt = val >> 1; + if((idx+loopcnt-1) > vc_maxhandle) /* TALOS-2023-1789 */ + { + chk_report_abort("TALOS-2023-1789"); + } + for(i=0;i> 1; + + if((idx+loopcnt-1) > vc_maxhandle) /* TALOS-2023-1789 */ + { + chk_report_abort("TALOS-2023-1789"); + } + for(i=0;i= mem_required_for_traversal) + { + chk_report_abort("TALOS-2023-1785"); + } + if(mc_mem_len < chain_table_lengths[i]) { free(mc_mem); @@ -5579,6 +5697,12 @@ { int destlen = chain_table_lengths[i] - skiplen; unsigned char *mu = mem_for_traversal + traversal_mem_offs; + + if(traversal_mem_offs >= mem_required_for_traversal) + { + chk_report_abort("TALOS-2023-1785"); + } + fstFread(mu, destlen, 1, xc->f); /* data to process is for(j=0;j> 1; } + if(tdelta >= tc_head_items) + { + chk_report_abort("TALOS-2023-1791"); + } + scatterptr[i] = tc_head[tdelta]; tc_head[tdelta] = i+1; } @@ -5633,16 +5762,16 @@ } } - if(dumpvars_state == 1) { wx_len = sprintf(wx_buf, "$end\n"); fstWritex(xc, wx_buf, wx_len); dumpvars_state = 2; } - wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", time_table[i]); + if(dumpvars_state == 1) { wx_len = snprintf(wx_buf, 32, "$end\n"); fstWritex(xc, wx_buf, wx_len); dumpvars_state = 2; } + wx_len = snprintf(wx_buf, 32, "#%" PRIu64 "\n", time_table[i]); fstWritex(xc, wx_buf, wx_len); - if(!dumpvars_state) { wx_len = sprintf(wx_buf, "$dumpvars\n"); fstWritex(xc, wx_buf, wx_len); dumpvars_state = 1; } + if(!dumpvars_state) { wx_len = snprintf(wx_buf, 32, "$dumpvars\n"); fstWritex(xc, wx_buf, wx_len); dumpvars_state = 1; } if((xc->num_blackouts)&&(cur_blackout != xc->num_blackouts)) { if(time_table[i] == xc->blackout_times[cur_blackout]) { - wx_len = sprintf(wx_buf, "$dump%s $end\n", (xc->blackout_activity[cur_blackout++]) ? "on" : "off"); + wx_len = snprintf(wx_buf, 32, "$dump%s $end\n", (xc->blackout_activity[cur_blackout++]) ? "on" : "off"); fstWritex(xc, wx_buf, wx_len); } } @@ -5702,6 +5831,11 @@ shamt = 2 << (vli & 1); tdelta = vli >> shamt; + if((tdelta+i) >= tc_head_items) + { + chk_report_abort("TALOS-2023-1791"); + } + scatterptr[idx] = tc_head[i+tdelta]; tc_head[i+tdelta] = idx+1; } @@ -5735,6 +5869,14 @@ vcdid_len = fstVcdIDForFwrite(vcd_id+1, idx+1); { + if(sizeof(size_t) < sizeof(uint64_t)) + { + /* TALOS-2023-1790 for 32b overflow */ + uint64_t chk_64 = len*4 + 1; + size_t chk_32 = len*4 + 1; + if(chk_64 != chk_32) chk_report_abort("TALOS-2023-1790"); + } + unsigned char *vesc = (unsigned char *)malloc(len*4 + 1); int vlen = fstUtilityBinToEsc(vesc, vdata, len); fstWritex(xc, vesc, vlen); @@ -5760,6 +5902,11 @@ vli = fstGetVarint32NoSkip(mem_for_traversal + headptr[idx]); tdelta = vli >> 1; + if((tdelta+i) >= tc_head_items) + { + chk_report_abort("TALOS-2023-1791"); + } + scatterptr[idx] = tc_head[i+tdelta]; tc_head[i+tdelta] = idx+1; } @@ -5776,6 +5923,11 @@ if(xc->signal_typs[idx] != FST_VT_VCD_REAL) { + if(len > xc->longest_signal_value_len) + { + chk_report_abort("TALOS-2023-1797"); + } + if(!(vli & 1)) { int byte = 0; @@ -5823,6 +5975,10 @@ unsigned char ch_bp = (xc->signal_typs[idx] != FST_VT_VCD_PORT) ? 'b' : 'p'; fstWritex(xc, &ch_bp, 1); + if((vdata - mem_for_traversal + len) > mem_required_for_traversal) + { + chk_report_abort("TALOS-2023-1793"); + } fstWritex(xc, vdata, len); } } @@ -5892,7 +6048,7 @@ clone_d[j] = srcdata[7-j]; } } - sprintf((char *)xc->temp_signal_value_buf, "%.16g", d); + snprintf((char *)xc->temp_signal_value_buf, xc->longest_signal_value_len + 1, "%.16g", d); value_change_callback(user_callback_data_pointer, time_table[i], idx+1, xc->temp_signal_value_buf); } } @@ -5918,7 +6074,7 @@ } } - wx_len = sprintf(wx_buf, "r%.16g", d); + wx_len = snprintf(wx_buf, 32, "r%.16g", d); fstWritex(xc, wx_buf, wx_len); } } @@ -5945,6 +6101,11 @@ vli = fstGetVarint32NoSkip(mem_for_traversal + headptr[idx]); tdelta = vli >> 1; + if((tdelta+i) >= tc_head_items) + { + chk_report_abort("TALOS-2023-1791"); + } + scatterptr[idx] = tc_head[i+tdelta]; tc_head[i+tdelta] = idx+1; } @@ -6024,7 +6185,7 @@ } } - sprintf((char *)buf, "%.16g", d); + snprintf((char *)buf, 32, "%.16g", d); /* this will write 18 bytes */ } } @@ -6616,7 +6777,7 @@ } } - sprintf(buf, "r%.16g", d); + snprintf(buf, 32, "r%.16g", d); /* this will write 19 bytes */ return(buf); } } diff -Nru gtkwave-3.3.114/src/helpers/lxt2_read.c gtkwave-3.3.118/src/helpers/lxt2_read.c --- gtkwave-3.3.114/src/helpers/lxt2_read.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/lxt2_read.c 2023-12-31 21:11:04.000000000 +0000 @@ -90,6 +90,16 @@ /****************************************************************************/ /* + * report abort messages + */ +static void chk_report_abort(const char *s) +{ +fprintf(stderr,"Triggered %s security check, exiting.\n", s); +abort(); +} + + +/* * fast SWAR ones count for 32 and 64 bits */ #if LXT2_RD_GRANULE_SIZE > 32 @@ -141,6 +151,11 @@ int i; int len2 = len-1; +if(len >= sizeof(s)) + { + chk_report_abort("TALOS-2023-1827"); + } + for(i=0;ilen[idx];i++) { lt->value[idx][i] ^= 1; } break; case LXT2_RD_ENC_LSH0: - case LXT2_RD_ENC_LSH1: memmove(lt->value[idx], lt->value[idx]+1, lt->len[idx]-1); + case LXT2_RD_ENC_LSH1: if(!lt->len[idx]) + { + chk_report_abort("TALOS-2023-1824"); + } + memmove(lt->value[idx], lt->value[idx]+1, lt->len[idx]-1); lt->value[idx][lt->len[idx]-1] = '0'+(vch-LXT2_RD_ENC_LSH0); break; case LXT2_RD_ENC_RSH0: - case LXT2_RD_ENC_RSH1: memmove(lt->value[idx]+1, lt->value[idx], lt->len[idx]-1); + case LXT2_RD_ENC_RSH1: if(!lt->len[idx]) + { + chk_report_abort("TALOS-2023-1824"); + } + memmove(lt->value[idx]+1, lt->value[idx], lt->len[idx]-1); lt->value[idx][0] = '0'+(vch-LXT2_RD_ENC_RSH0); break; @@ -598,7 +621,21 @@ if(b->num_dict_entries) { + { + size_t chk_x = b->num_dict_entries * sizeof(char *); + if((chk_x / sizeof(char *)) != b->num_dict_entries) + { + chk_report_abort("TALOS-2023-1820"); + } + } b->string_pointers = malloc(b->num_dict_entries * sizeof(char *)); + { + size_t chk_x = b->num_dict_entries * sizeof(unsigned int); + if((chk_x / sizeof(unsigned int)) != b->num_dict_entries) + { + chk_report_abort("TALOS-2023-1820"); + } + } b->string_lens = malloc(b->num_dict_entries * sizeof(unsigned int)); pnt = b->dict_start; for(i=0;inum_dict_entries;i++) @@ -662,6 +699,10 @@ /* fprintf(stderr, LXT2_RDLOAD"processing granule %d\n", granule); */ pnt++; lt->num_time_table_entries = lxt2_rd_get_byte(pnt, 0); + if(lt->num_time_table_entries > LXT2_RD_GRANULE_SIZE) + { + chk_report_abort("TALOS-2023-1819"); + } pnt++; for(i=0;inum_time_table_entries;i++) { @@ -884,6 +925,13 @@ lt->zhandle = gzdopen(dup(fileno(lt->handle)), "rb"); t = lt->numfacs * 4 * sizeof(lxtint32_t); + { + size_t chk_x = lt->numfacs * 4 * sizeof(lxtint32_t); + if((chk_x / (4 * sizeof(lxtint32_t))) != lt->numfacs) + { + chk_report_abort("TALOS-2023-1818"); + } + } m=(char *)malloc(t); rc=gzread(lt->zhandle, m, t); gzclose(lt->zhandle); lt->zhandle=NULL; @@ -899,11 +947,25 @@ pos = pos+lt->zfacgeometrysize; + { + size_t chk_x = lt->numfacs * sizeof(lxtint32_t); + if((chk_x / sizeof(lxtint32_t)) != lt->numfacs) + { + chk_report_abort("TALOS-2023-1818"); + } + } lt->rows = malloc(lt->numfacs * sizeof(lxtint32_t)); lt->msb = malloc(lt->numfacs * sizeof(lxtsint32_t)); lt->lsb = malloc(lt->numfacs * sizeof(lxtsint32_t)); lt->flags = malloc(lt->numfacs * sizeof(lxtint32_t)); lt->len = malloc(lt->numfacs * sizeof(lxtint32_t)); + { + size_t chk_x = lt->numfacs * sizeof(char *); + if((chk_x / sizeof(char *)) != lt->numfacs) + { + chk_report_abort("TALOS-2023-1818"); + } + } lt->value = malloc(lt->numfacs * sizeof(char *)); lt->next_radix = malloc(lt->numfacs * sizeof(void *)); @@ -922,6 +984,13 @@ { lt->len[i] = 32; } + if(sizeof(size_t) < sizeof(uint64_t)) + { + /* TALOS-2023-1821 for 32b overflow */ + uint64_t chk_64 = lt->len[i] + 1; + size_t chk_32 = lt->len[i] + 1; + if(chk_64 != chk_32) chk_report_abort("TALOS-2023-1821"); + } lt->value[i] = calloc(lt->len[i] + 1, sizeof(char)); } @@ -1261,12 +1330,24 @@ clone=lxt2_rd_get_16(lt->faccache->n, 0); lt->faccache->n+=2; pnt=lt->faccache->bufcurr; + if(clone > lt->longestname) + { + chk_report_abort("TALOS-2023-1826"); + } + for(j=0;jfaccache->bufprev[j]; } - while((*(pnt++)=lxt2_rd_get_byte(lt->faccache->n++,0))); + do + { + if((pnt - lt->faccache->bufcurr) > lt->longestname) + { + chk_report_abort("TALOS-2023-1826"); + } + } + while((*(pnt++)=lxt2_rd_get_byte(lt->faccache->n++,0))); lt->faccache->old_facidx = facidx; return(lt->faccache->bufcurr); } @@ -1526,6 +1607,11 @@ rcf = fread(&unclen, 4, 1, lt->handle); unclen = rcf ? lxt2_rd_get_32(&unclen,0) : 0; rcf = fread(&iter, 4, 1, lt->handle); iter = rcf ? lxt2_rd_get_32(&iter,0) : 0; + if(unclen > b->uncompressed_siz) + { + chk_report_abort("TALOS-2023-1823"); /* could fix this up with a realloc(), but abort to indicate the file is malformed */ + } + fspos += 12; if((iter==0xFFFFFFFF)||(lt->process_mask_compressed[iter/LXT2_RD_PARTIAL_SIZE])) { @@ -1533,6 +1619,10 @@ { if(zbuff) free(zbuff); zlen = clen * 2; + if(zlen < clen) + { + chk_report_abort("TALOS-2023-1822"); + } zbuff = malloc(zlen ? zlen : 1 /* scan-build */); } diff -Nru gtkwave-3.3.114/src/helpers/vcd2fst.c gtkwave-3.3.118/src/helpers/vcd2fst.c --- gtkwave-3.3.114/src/helpers/vcd2fst.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/vcd2fst.c 2023-12-31 21:11:04.000000000 +0000 @@ -68,6 +68,43 @@ return(pnt); } +/******************************************************/ + +static FILE *popen_san(const char *command, const char *type) /* TALOS-2023-1786 */ +{ +const char *p = command; +int is_ok = 1; +char ch; + +while(p && (ch = *(p++))) + { + switch(ch) + { + case '&': + case '|': + case ';': + case '\n': + case '`': + case '$': + is_ok = 0; + + default: + break; + } + } + +if(is_ok) + { + return(popen(command, type)); + } +else + { + fprintf(stderr, "GTKWAVE | TALOS-2023-1786: popen() command string '%s' may not be properly sanitized, blocking command.\n", command); + return(NULL); + } +} + +/******************************************************/ /*********************************************************/ /*** vvv extload component type name determination vvv ***/ @@ -281,7 +318,7 @@ void *xc = fstReaderOpenForUtilitiesOnly(); sprintf(sbuff, "%s -info %s 2>&1", EXTLOAD_PATH, fname); -extload = popen(sbuff, "r"); +extload = popen_san(sbuff, "r"); if(extload) { while(get_info(extload)); @@ -295,7 +332,7 @@ } sprintf(sbuff, "%s -tree %s 2>&1", EXTLOAD_PATH, fname); -extload = popen(sbuff, "r"); +extload = popen_san(sbuff, "r"); if(extload) { while(get_scopename(xc, extload)); @@ -482,7 +519,7 @@ if(suffix_check(vname, "."EXTLOAD_SUFFIX) || suffix_check(vname, "."EXTLOAD_SUFFIX".gz") || suffix_check(vname, "."EXTLOAD_SUFFIX".bz2")) { sprintf(bin_fixbuff, EXTCONV_PATH" %s", vname); - f = popen(bin_fixbuff, "r"); + f = popen_san(bin_fixbuff, "r"); is_popen = 1; is_extload = 1; #ifndef _WAVE_HAVE_JUDY @@ -497,7 +534,7 @@ if(suffix_check(vname, "."EXT2LOAD_SUFFIX)) { sprintf(bin_fixbuff, EXT2CONV_PATH" %s", vname); - f = popen(bin_fixbuff, "r"); + f = popen_san(bin_fixbuff, "r"); is_popen = 1; } else @@ -506,7 +543,7 @@ if(suffix_check(vname, "."EXT3LOAD_SUFFIX)) { sprintf(bin_fixbuff, EXT3CONV_PATH" %s", vname); - f = popen(bin_fixbuff, "r"); + f = popen_san(bin_fixbuff, "r"); is_popen = 1; } else diff -Nru gtkwave-3.3.114/src/helpers/vcd2lxt.c gtkwave-3.3.118/src/helpers/vcd2lxt.c --- gtkwave-3.3.114/src/helpers/vcd2lxt.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/vcd2lxt.c 2023-12-31 21:11:04.000000000 +0000 @@ -139,6 +139,53 @@ /******************************************************************/ +/* + * report abort messages + */ +static void chk_report_abort(const char *s) +{ +fprintf(stderr,"Triggered %s security check, exiting.\n", s); +abort(); +} + +/******************************************************************/ + +static FILE *popen_san(const char *command, const char *type) /* TALOS-2023-1786 */ +{ +const char *p = command; +int is_ok = 1; +char ch; + +while(p && (ch = *(p++))) + { + switch(ch) + { + case '&': + case '|': + case ';': + case '\n': + case '`': + case '$': + is_ok = 0; + + default: + break; + } + } + +if(is_ok) + { + return(popen(command, type)); + } +else + { + fprintf(stderr, "GTKWAVE | TALOS-2023-1786: popen() command string '%s' may not be properly sanitized, blocking command.\n", command); + return(NULL); + } +} + +/******************************************************************/ + static unsigned int vcd_minid = ~0; static unsigned int vcd_maxid = 0; @@ -193,6 +240,8 @@ { return(indexed[hsh-vcd_minid]); } + + return(NULL); /* TALOS-2023-1807 */ } v=(struct vcdsymbol **)bsearch(key, sorted, numsyms, @@ -556,7 +605,16 @@ { if(len==T_MAX_STR) { - yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + if(!varsplit) + { + yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + } + else /* TALOS-2023-1806 */ + { + int vsplit_len = varsplit - yytext; /* save old len */ + yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + varsplit = yytext+vsplit_len; /* reconstruct old len in new buffer */ + } } ch=getch(); @@ -925,7 +983,7 @@ } else { - if(yylen_cachesize) + if(yylen_cache<=v->size) /* TALOS-2023-1804 */ { free_2(vector); vector=malloc_2(v->size+1); @@ -1137,6 +1195,11 @@ int vtok; struct vcdsymbol *v=NULL; + if(header_over) + { + chk_report_abort("TALOS-2023-1805: $var after $enddefinitions"); + } + var_prevch=0; if(varsplit) { @@ -1661,7 +1724,7 @@ str=(char *)wave_alloca(strlen(fname)+dlen+1); strcpy(str,WAVE_DECOMPRESSOR); strcpy(str+dlen,fname); - vcd_handle=popen(str,"r"); + vcd_handle=popen_san(str,"r"); vcd_is_compressed=~0; } else diff -Nru gtkwave-3.3.114/src/helpers/vcd2lxt2.c gtkwave-3.3.118/src/helpers/vcd2lxt2.c --- gtkwave-3.3.114/src/helpers/vcd2lxt2.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/vcd2lxt2.c 2023-12-31 21:11:04.000000000 +0000 @@ -145,6 +145,53 @@ /******************************************************************/ +/* + * report abort messages + */ +static void chk_report_abort(const char *s) +{ +fprintf(stderr,"Triggered %s security check, exiting.\n", s); +abort(); +} + +/******************************************************************/ + +static FILE *popen_san(const char *command, const char *type) /* TALOS-2023-1786 */ +{ +const char *p = command; +int is_ok = 1; +char ch; + +while(p && (ch = *(p++))) + { + switch(ch) + { + case '&': + case '|': + case ';': + case '\n': + case '`': + case '$': + is_ok = 0; + + default: + break; + } + } + +if(is_ok) + { + return(popen(command, type)); + } +else + { + fprintf(stderr, "GTKWAVE | TALOS-2023-1786: popen() command string '%s' may not be properly sanitized, blocking command.\n", command); + return(NULL); + } +} + +/******************************************************************/ + static unsigned int vcd_minid = ~0; static unsigned int vcd_maxid = 0; @@ -199,6 +246,8 @@ { return(indexed[hsh-vcd_minid]); } + + return(NULL); /* TALOS-2023-1807 */ } v=(struct vcdsymbol **)bsearch(key, sorted, numsyms, @@ -561,7 +610,16 @@ { if(len==T_MAX_STR) { - yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + if(!varsplit) + { + yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + } + else /* TALOS-2023-1806 */ + { + int vsplit_len = varsplit - yytext; /* save old len */ + yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + varsplit = yytext+vsplit_len; /* reconstruct old len in new buffer */ + } } ch=getch(); @@ -930,7 +988,7 @@ } else { - if(yylen_cachesize) + if(yylen_cache<=v->size) /* TALOS-2023-1804 */ { free_2(vector); vector=malloc_2(v->size+1); @@ -1139,6 +1197,11 @@ int vtok; struct vcdsymbol *v=NULL; + if(header_over) + { + chk_report_abort("TALOS-2023-1805: $var after $enddefinitions"); + } + var_prevch=0; if(varsplit) { @@ -1585,7 +1648,7 @@ str=(char *)wave_alloca(strlen(fname)+dlen+1); strcpy(str,WAVE_DECOMPRESSOR); strcpy(str+dlen,fname); - vcd_handle=popen(str,"r"); + vcd_handle=popen_san(str,"r"); vcd_is_compressed=~0; } else diff -Nru gtkwave-3.3.114/src/helpers/vcd2vzt.c gtkwave-3.3.118/src/helpers/vcd2vzt.c --- gtkwave-3.3.114/src/helpers/vcd2vzt.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/vcd2vzt.c 2023-12-31 21:11:04.000000000 +0000 @@ -147,6 +147,53 @@ /******************************************************************/ +/* + * report abort messages + */ +static void chk_report_abort(const char *s) +{ +fprintf(stderr,"Triggered %s security check, exiting.\n", s); +abort(); +} + +/******************************************************************/ + +static FILE *popen_san(const char *command, const char *type) /* TALOS-2023-1786 */ +{ +const char *p = command; +int is_ok = 1; +char ch; + +while(p && (ch = *(p++))) + { + switch(ch) + { + case '&': + case '|': + case ';': + case '\n': + case '`': + case '$': + is_ok = 0; + + default: + break; + } + } + +if(is_ok) + { + return(popen(command, type)); + } +else + { + fprintf(stderr, "GTKWAVE | TALOS-2023-1786: popen() command string '%s' may not be properly sanitized, blocking command.\n", command); + return(NULL); + } +} + +/******************************************************************/ + static unsigned int vcd_minid = ~0; static unsigned int vcd_maxid = 0; @@ -201,6 +248,8 @@ { return(indexed[hsh-vcd_minid]); } + + return(NULL); /* TALOS-2023-1807 */ } v=(struct vcdsymbol **)bsearch(key, sorted, numsyms, @@ -563,7 +612,16 @@ { if(len==T_MAX_STR) { - yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + if(!varsplit) + { + yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + } + else /* TALOS-2023-1806 */ + { + int vsplit_len = varsplit - yytext; /* save old len */ + yytext=(char *)realloc_2(yytext, (T_MAX_STR=T_MAX_STR*2)+1); + varsplit = yytext+vsplit_len; /* reconstruct old len in new buffer */ + } } ch=getch(); @@ -932,7 +990,7 @@ } else { - if(yylen_cachesize) + if(yylen_cache<=v->size) /* TALOS-2023-1804 */ { free_2(vector); vector=malloc_2(v->size+1); @@ -1149,6 +1207,11 @@ int vtok; struct vcdsymbol *v=NULL; + if(header_over) + { + chk_report_abort("TALOS-2023-1805: $var after $enddefinitions"); + } + var_prevch=0; if(varsplit) { @@ -1595,7 +1658,7 @@ str=(char *)wave_alloca(strlen(fname)+dlen+1); strcpy(str,WAVE_DECOMPRESSOR); strcpy(str+dlen,fname); - vcd_handle=popen(str,"r"); + vcd_handle=popen_san(str,"r"); vcd_is_compressed=~0; } else diff -Nru gtkwave-3.3.114/src/helpers/vzt_read.c gtkwave-3.3.118/src/helpers/vzt_read.c --- gtkwave-3.3.114/src/helpers/vzt_read.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/vzt_read.c 2023-12-31 21:11:04.000000000 +0000 @@ -38,6 +38,17 @@ /****************************************************************************/ +/* + * report abort messages + */ +static void chk_report_abort(const char *s) +{ +fprintf(stderr,"Triggered %s security check, exiting.\n", s); +abort(); +} + +/****************************************************************************/ + static int is_big_endian(void) { union @@ -171,19 +182,19 @@ } -static vztint32_t vzt_rd_get_v32(char **mmx) +static vztint32_t vzt_rd_get_v32(unsigned char **mmx) { -signed char *c; -signed char *beg; +unsigned char *c; +unsigned char *beg; vztint32_t val; -signed char **mm = (signed char **)mmx; +unsigned char **mm = mmx; c = *mm; beg = c; -if(*c>=0) +if(!(*c & 0x80)) { - while(*c>=0) c++; + while(!(*c & 0x80)) c++; *mm = c+1; val = (vztint32_t)(*c&0x7f); @@ -202,19 +213,19 @@ return(val); } -static vztint64_t vzt_rd_get_v64(char **mmx) +static vztint64_t vzt_rd_get_v64(unsigned char **mmx) { -signed char *c; -signed char *beg; +unsigned char *c; +unsigned char *beg; vztint64_t val; -signed char **mm = (signed char **)mmx; +unsigned char **mm = mmx; c = *mm; beg = c; -if(*c>=0) +if(!(*c & 0x80)) { - while(*c>=0) c++; + while(!(*c & 0x80)) c++; *mm = c+1; val = (vztint64_t)(*c&0x7f); @@ -314,7 +325,7 @@ vztint32_t *change_dict=NULL; vztint32_t *val_dict=NULL; unsigned int num_time_ticks, num_sections, num_dict_entries; -char *pnt = b->mem; +unsigned char *pnt = b->mem; vztint32_t i, j, m, num_dict_words; /* vztint32_t *block_end = (vztint32_t *)(pnt + b->uncompressed_siz); */ vztint32_t *val_tmp; @@ -326,6 +337,13 @@ if(num_time_ticks != 0) { vztint64_t cur_time; + { + size_t chk_x = num_time_ticks * sizeof(vztint64_t); + if((chk_x / sizeof(vztint64_t)) != num_time_ticks) + { + chk_report_abort("TALOS-2023-1814"); + } + } times = malloc(num_time_ticks * sizeof(vztint64_t)); times[0] = cur_time = vzt_rd_get_v64(&pnt); for(i=1;istart; num_time_ticks = b->end - b->start + 1; + { + size_t chk_x = num_time_ticks * sizeof(vztint64_t); + if((chk_x / sizeof(vztint64_t)) != num_time_ticks) + { + chk_report_abort("TALOS-2023-1814"); + } + } times = malloc(num_time_ticks * sizeof(vztint64_t)); for(i=0;inum_rle_bytes = (num_dict_words = num_sections * num_dict_entries) * sizeof(vztint32_t)); curr_dec_dict = val_dict; @@ -444,7 +483,20 @@ } } +if(num_sections && num_dict_entries) + { + size_t chk_x = (num_sections * num_dict_entries); + size_t chk_y = chk_x * sizeof(vztint32_t); + if((chk_x/num_sections) != num_dict_entries) + { + chk_report_abort("TALOS-2023-1815"); + } + if((chk_y/sizeof(vztint32_t)) != chk_x) + { + chk_report_abort("TALOS-2023-1815"); + } + } num_dict_words = (num_sections * num_dict_entries) * sizeof(vztint32_t); change_dict = malloc(num_dict_words ? num_dict_words : sizeof(vztint32_t)); /* scan-build */ m = 0; @@ -782,7 +834,7 @@ else { unsigned int spnt=vzt_rd_make_sindex(pnt); - char *msg = ((!i)&(!b->prev)) ? "UNDEF" : b->sindex[spnt]; + char *msg = ((!i)&&(b->prev)) ? "UNDEF" : b->sindex[spnt]; lt->value_change_callback(<, &b->times[i], &idx, &msg); } } @@ -857,7 +909,7 @@ else { unsigned int spnt=vzt_rd_make_sindex(pnt); - char *msg = ((!i)&(!b->prev)) ? "UNDEF" : b->sindex[spnt]; + char *msg = ((!i)&&(b->prev)) ? "UNDEF" : b->sindex[spnt]; lt->value_change_callback(<, &b->times[i], &idx, &msg); } } @@ -866,10 +918,17 @@ i2 = vzt_rd_next_value_chg_time(lt, b, i, idx); if(i2) { - struct vzt_ncycle_autosort *t = autosort[i2]; - - autofacs[idx].next = t; - autosort[i2] = autofacs+idx; + if(i2 < b->num_time_ticks) + { + struct vzt_ncycle_autosort *t = autosort[i2]; + + autofacs[idx].next = t; + autosort[i2] = autofacs+idx; + } + else + { + chk_report_abort("TALOS-2023-1817"); + } } else { @@ -908,7 +967,7 @@ else { unsigned int spnt=vzt_rd_make_sindex(pnt); - char *msg = ((!i)&(!b->prev)) ? "UNDEF" : b->sindex[spnt]; + char *msg = ((!i)&&(b->prev)) ? "UNDEF" : b->sindex[spnt]; lt->value_change_callback(<, &b->times[i], &idx, &msg); } } @@ -917,10 +976,17 @@ if(i2!=i) { - struct vzt_ncycle_autosort *ta = autosort[i2]; + if(i2 < b->num_time_ticks) + { + struct vzt_ncycle_autosort *ta = autosort[i2]; - autofacs[idx].next = ta; - autosort[i2] = autofacs+idx; + autofacs[idx].next = ta; + autosort[i2] = autofacs+idx; + } + else + { + chk_report_abort("TALOS-2023-1817"); + } } else { @@ -1131,12 +1197,24 @@ clonecnt=vzt_rd_get_16(lt->faccache->n, 0); lt->faccache->n+=2; pnt=lt->faccache->bufcurr; + if(clonecnt > lt->longestname) + { + chk_report_abort("TALOS-2023-1813"); + } + for(j=0;jfaccache->bufprev[j]; } - while((*(pnt++)=vzt_rd_get_byte(lt->faccache->n++,0))); + char *bufcurr_exceeded = lt->faccache->bufcurr + (lt->longestname+1); + do + { + if(bufcurr_exceeded == pnt) + { + chk_report_abort("TALOS-2023-1813"); + } + } while((*(pnt++)=vzt_rd_get_byte(lt->faccache->n++,0))); lt->faccache->old_facidx = facidx; return(lt->faccache->bufcurr); } @@ -1853,6 +1931,13 @@ pos = pos+lt->zfacgeometrysize; + { + size_t chk_x = lt->numfacs * sizeof(vztint32_t); + if((chk_x / sizeof(vztint32_t)) != lt->numfacs) + { + chk_report_abort("TALOS-2023-1812"); + } + } lt->rows = malloc(lt->numfacs * sizeof(vztint32_t)); lt->msb = malloc(lt->numfacs * sizeof(vztsint32_t)); lt->lsb = malloc(lt->numfacs * sizeof(vztsint32_t)); @@ -1887,6 +1972,14 @@ } } + if(sizeof(size_t) < sizeof(uint64_t)) + { + if(lt->longest_len == 0xffffffff) + { + chk_report_abort("TALOS-2023-1816"); + } + } + vindex_offset = 0; /* offset in value table */ for(lt->numrealfacs=0; lt->numrealfacsnumfacs; lt->numrealfacs++) { diff -Nru gtkwave-3.3.114/src/helpers/vzt_write.c gtkwave-3.3.118/src/helpers/vzt_write.c --- gtkwave-3.3.114/src/helpers/vzt_write.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/helpers/vzt_write.c 2023-12-31 21:11:04.000000000 +0000 @@ -1259,7 +1259,9 @@ struct vzt_wr_symbol *s = lt->sorted_facs[j]; for(i=0;ilen;i++) { - lt->use_multi_state |= s->chgx[i]; + if (s->chgx[i] != 0) { + lt->use_multi_state = 1; + } t = vzt_wr_dsvzt_splay(s->chgx[i], t); if(!vzt_wr_dsvzt_success) { @@ -1308,7 +1310,9 @@ for(i=0;ilen;i++) { t = s->prevx[i]->child; - lt->use_multi_state |= s->chgx[i]; + if (s->chgx[i] != 0) { + lt->use_multi_state = 1; + } t = vzt_wr_dsvzt_splay(s->chgx[i], t); if(!vzt_wr_dsvzt_success) { diff -Nru gtkwave-3.3.114/src/libghw.c gtkwave-3.3.118/src/libghw.c --- gtkwave-3.3.114/src/libghw.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/libghw.c 2023-12-31 21:11:04.000000000 +0000 @@ -22,6 +22,7 @@ #include #include "libghw.h" +#include "debug.h" /* Reopen H through decompressor DECOMP. */ @@ -33,7 +34,7 @@ snprintf (p, plen, "%s %s", decomp, filename); fclose (h->stream); - h->stream = popen (p, "r"); + h->stream = popen_san (p, "r"); free (p); if (h->stream == NULL) diff -Nru gtkwave-3.3.114/src/liblzma/LzmaLib.c gtkwave-3.3.118/src/liblzma/LzmaLib.c --- gtkwave-3.3.114/src/liblzma/LzmaLib.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/liblzma/LzmaLib.c 2023-12-31 21:11:04.000000000 +0000 @@ -51,6 +51,16 @@ }; +/* + * report abort messages + */ +static void chk_report_abort(const char *s) +{ +fprintf(stderr,"Triggered %s security check, exiting.\n", s); +abort(); +} + + static void LZMA_write_varint(struct lzma_handle_t *h, size_t v) { size_t nxt; @@ -72,16 +82,22 @@ /* ifdef is warnings fix if XZ is not present */ static size_t LZMA_read_varint(struct lzma_handle_t *h) { -unsigned char buf[16]; +int chk_len = 16; /* TALOS-2023-1811 */ +unsigned char buf[chk_len]; int idx = 0; size_t rc = 0; -for(;;) +while(idxread_cnt += read(h->fd, buf+idx, 1); if(buf[idx++] & 0x80) break; } +if(idx == chk_len) + { + chk_report_abort("TALOS-2023-1811"); + } + do { idx--; @@ -324,6 +340,21 @@ srclen = LZMA_read_varint(h); + if(srclen > h->blksiz) /* TALOS-2023-1810 */ + { + if(h->dmem) + { + free(h->dmem); + } + if(h->mem) + { + free(h->mem); + } + h->blksiz = srclen; + h->mem = malloc(h->blksiz); + h->dmem = malloc(h->blksiz); + } + if(!srclen) { h->read_cnt += (rc = read(h->fd, h->mem, dstlen)); @@ -335,7 +366,7 @@ lzma_stream strm = LZMA_STREAM_INIT; lzma_ret lrc; - h->read_cnt += (rc = read(h->fd, h->dmem, srclen)); + h->read_cnt += (rc = read(h->fd, h->dmem, srclen)); /* TALOS-2023-1810: srclen used here, generally ok as data are compressible */ lrc = lzma_alone_decoder(&strm, LZMA_DECODER_SIZE); if(lrc != LZMA_OK) diff -Nru gtkwave-3.3.114/src/main.c gtkwave-3.3.118/src/main.c --- gtkwave-3.3.114/src/main.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/main.c 2023-12-31 21:11:04.000000000 +0000 @@ -1926,7 +1926,7 @@ str=wave_alloca(strlen(wname)+dlen+1); strcpy(str,WAVE_DECOMPRESSOR); strcpy(str+dlen,wname); - wave=popen(str,"r"); + wave=popen_san(str,"r"); wave_is_compressed=~0; } else @@ -1974,7 +1974,7 @@ if(wave_is_compressed) { pclose(wave); - wave=popen(str,"r"); + wave=popen_san(str,"r"); } else { diff -Nru gtkwave-3.3.114/src/menu.c gtkwave-3.3.118/src/menu.c --- gtkwave-3.3.114/src/menu.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/menu.c 2023-12-31 21:11:04.000000000 +0000 @@ -7415,6 +7415,9 @@ else { GLOBALS->show_base = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu_wlist[WV_MENU_VSBS])); + if (!GLOBALS->signalarea || !GLOBALS->wavewindow) { + return; + } GLOBALS->signalwindow_width_dirty=1; MaxSignalLength(); signalarea_configure_event(GLOBALS->signalarea, NULL); diff -Nru gtkwave-3.3.114/src/ptranslate.c gtkwave-3.3.118/src/ptranslate.c --- gtkwave-3.3.114/src/ptranslate.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/ptranslate.c 2023-12-31 21:11:04.000000000 +0000 @@ -166,7 +166,7 @@ #if !defined __MINGW32__ cmd = (char *)malloc_2(strlen(exec_name)+6+1); sprintf(cmd, "which %s", exec_name); - stream = popen(cmd, "r"); + stream = popen_san(cmd, "r"); result = fscanf(stream, "%s", abs_path); diff -Nru gtkwave-3.3.114/src/savefile.c gtkwave-3.3.118/src/savefile.c --- gtkwave-3.3.114/src/savefile.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/savefile.c 2023-12-31 21:11:04.000000000 +0000 @@ -667,7 +667,7 @@ str=wave_alloca(strlen(wname)+5+1); strcpy(str,"zcat "); strcpy(str+5,wname); - wave=popen(str,"r"); + wave=popen_san(str,"r"); wave_is_compressed=~0; } else @@ -804,7 +804,7 @@ if(wave_is_compressed) { pclose(wave); - wave=popen(str,"r"); + wave=popen_san(str,"r"); } else { diff -Nru gtkwave-3.3.114/src/ttranslate.c gtkwave-3.3.118/src/ttranslate.c --- gtkwave-3.3.114/src/ttranslate.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/ttranslate.c 2023-12-31 21:11:04.000000000 +0000 @@ -187,7 +187,7 @@ #if !defined __MINGW32__ cmd = (char *)malloc_2(strlen(exec_name)+6+1); sprintf(cmd, "which %s", exec_name); - stream = popen(cmd, "r"); + stream = popen_san(cmd, "r"); result = fscanf(stream, "%s", abs_path); diff -Nru gtkwave-3.3.114/src/twinwave.c gtkwave-3.3.118/src/twinwave.c --- gtkwave-3.3.114/src/twinwave.c 2021-09-06 20:39:11.000000000 +0000 +++ gtkwave-3.3.118/src/twinwave.c 2023-12-31 21:11:04.000000000 +0000 @@ -19,7 +19,7 @@ #include #endif #if GTK_CHECK_VERSION(3,22,26) -#if !defined(MAC_INTEGRATION) +#if !defined(MAC_INTEGRATION) && defined(GDK_WINDOWING_WAYLAND) #include #endif #endif diff -Nru gtkwave-3.3.114/src/vcd.c gtkwave-3.3.118/src/vcd.c --- gtkwave-3.3.114/src/vcd.c 2022-10-04 04:35:32.000000000 +0000 +++ gtkwave-3.3.118/src/vcd.c 2023-12-31 21:11:04.000000000 +0000 @@ -549,7 +549,16 @@ { if(len==GLOBALS->T_MAX_STR_vcd_c_1) { - GLOBALS->yytext_vcd_c_1=(char *)realloc_2(GLOBALS->yytext_vcd_c_1, (GLOBALS->T_MAX_STR_vcd_c_1=GLOBALS->T_MAX_STR_vcd_c_1*2)+1); + if(!GLOBALS->varsplit_vcd_c_1) + { + GLOBALS->yytext_vcd_c_1=(char *)realloc_2(GLOBALS->yytext_vcd_c_1, (GLOBALS->T_MAX_STR_vcd_c_1=GLOBALS->T_MAX_STR_vcd_c_1*2)+1); + } + else /* TALOS-2023-1806 */ + { + int vsplit_len = GLOBALS->varsplit_vcd_c_1 - GLOBALS->yytext_vcd_c_1; /* save old len */ + GLOBALS->yytext_vcd_c_1=(char *)realloc_2(GLOBALS->yytext_vcd_c_1, (GLOBALS->T_MAX_STR_vcd_c_1=GLOBALS->T_MAX_STR_vcd_c_1*2)+1); + GLOBALS->varsplit_vcd_c_1 = GLOBALS->yytext_vcd_c_1+vsplit_len; /* reconstruct old len in new buffer */ + } } ch=getch(); @@ -962,7 +971,7 @@ } else { - if(GLOBALS->yylen_cache_vcd_c_1size) + if(GLOBALS->yylen_cache_vcd_c_1<=v->size) /* TALOS-2023-1804 */ { free_2(vector); vector=malloc_2(v->size+1); @@ -1245,7 +1254,7 @@ sync_end(NULL); break; case T_VAR: - if((GLOBALS->header_over_vcd_c_1)&&(0)) + if(GLOBALS->header_over_vcd_c_1) /* reinstated because of TALOS-2023-1805 */ { fprintf(stderr,"$VAR encountered after $ENDDEFINITIONS near byte %d. VCD is malformed, exiting.\n", (int)(GLOBALS->vcdbyteno_vcd_c_1+(GLOBALS->vst_vcd_c_1-GLOBALS->vcdbuf_vcd_c_1))); @@ -2626,7 +2635,7 @@ str=wave_alloca(strlen(fname)+dlen+1); strcpy(str,WAVE_DECOMPRESSOR); strcpy(str+dlen,fname); - GLOBALS->vcd_handle_vcd_c_1=popen(str,"r"); + GLOBALS->vcd_handle_vcd_c_1=popen_san(str,"r"); GLOBALS->vcd_is_compressed_vcd_c_1=~0; } else diff -Nru gtkwave-3.3.114/src/vcd_partial.c gtkwave-3.3.118/src/vcd_partial.c --- gtkwave-3.3.114/src/vcd_partial.c 2022-10-04 04:40:18.000000000 +0000 +++ gtkwave-3.3.118/src/vcd_partial.c 2023-12-31 21:11:04.000000000 +0000 @@ -525,7 +525,16 @@ { if(len==GLOBALS->T_MAX_STR_vcd_partial_c_2) { - GLOBALS->yytext_vcd_partial_c_2=(char *)realloc_2(GLOBALS->yytext_vcd_partial_c_2, (GLOBALS->T_MAX_STR_vcd_partial_c_2=GLOBALS->T_MAX_STR_vcd_partial_c_2*2)+1); + if(!GLOBALS->varsplit_vcd_partial_c_2) + { + GLOBALS->yytext_vcd_partial_c_2=(char *)realloc_2(GLOBALS->yytext_vcd_partial_c_2, (GLOBALS->T_MAX_STR_vcd_partial_c_2=GLOBALS->T_MAX_STR_vcd_partial_c_2*2)+1); + } + else /* TALOS-2023-1806 */ + { + int vsplit_len = GLOBALS->varsplit_vcd_partial_c_2 - GLOBALS->yytext_vcd_partial_c_2; /* save old len */ + GLOBALS->yytext_vcd_partial_c_2=(char *)realloc_2(GLOBALS->yytext_vcd_partial_c_2, (GLOBALS->T_MAX_STR_vcd_partial_c_2=GLOBALS->T_MAX_STR_vcd_partial_c_2*2)+1); + GLOBALS->varsplit_vcd_partial_c_2 = GLOBALS->yytext_vcd_partial_c_2+vsplit_len; /* reconstruct old len in new buffer */ + } } ch=getch(); @@ -898,7 +907,7 @@ } else { - if(GLOBALS->yylen_cache_vcd_partial_c_2size) + if(GLOBALS->yylen_cache_vcd_partial_c_2<=v->size) /* TALOS-2023-1804 */ { free_2(vector); vector=malloc_2(v->size+1); @@ -1193,11 +1202,11 @@ sync_end(NULL); break; case T_VAR: - if((GLOBALS->header_over_vcd_partial_c_2)&&(0)) + if(GLOBALS->header_over_vcd_partial_c_2) /* reinstated because of TALOS-2023-1805 */ { fprintf(stderr,"$VAR encountered after $ENDDEFINITIONS near byte %d. VCD is malformed, exiting.\n", (int)(GLOBALS->vcdbyteno_vcd_partial_c_2+(GLOBALS->vst_vcd_partial_c_2-GLOBALS->vcdbuf_vcd_partial_c_2))); - exit(0); + exit(255); } else { diff -Nru gtkwave-3.3.114/src/vcd_recoder.c gtkwave-3.3.118/src/vcd_recoder.c --- gtkwave-3.3.114/src/vcd_recoder.c 2022-10-04 04:36:40.000000000 +0000 +++ gtkwave-3.3.118/src/vcd_recoder.c 2023-12-31 21:11:04.000000000 +0000 @@ -1054,7 +1054,16 @@ { if(len==GLOBALS->T_MAX_STR_vcd_recoder_c_3) { - GLOBALS->yytext_vcd_recoder_c_3=(char *)realloc_2(GLOBALS->yytext_vcd_recoder_c_3, (GLOBALS->T_MAX_STR_vcd_recoder_c_3=GLOBALS->T_MAX_STR_vcd_recoder_c_3*2)+1); + if(!GLOBALS->varsplit_vcd_recoder_c_3) + { + GLOBALS->yytext_vcd_recoder_c_3=(char *)realloc_2(GLOBALS->yytext_vcd_recoder_c_3, (GLOBALS->T_MAX_STR_vcd_recoder_c_3=GLOBALS->T_MAX_STR_vcd_recoder_c_3*2)+1); + } + else /* TALOS-2023-1806 */ + { + int vsplit_len = GLOBALS->varsplit_vcd_recoder_c_3 - GLOBALS->yytext_vcd_recoder_c_3; /* save old len */ + GLOBALS->yytext_vcd_recoder_c_3=(char *)realloc_2(GLOBALS->yytext_vcd_recoder_c_3, (GLOBALS->T_MAX_STR_vcd_recoder_c_3=GLOBALS->T_MAX_STR_vcd_recoder_c_3*2)+1); + GLOBALS->varsplit_vcd_recoder_c_3 = GLOBALS->yytext_vcd_recoder_c_3+vsplit_len; /* reconstruct old len in new buffer */ + } } ch=getch(); @@ -1587,7 +1596,7 @@ sync_end(NULL); break; case T_VAR: - if((GLOBALS->header_over_vcd_recoder_c_3)&&(0)) + if(GLOBALS->header_over_vcd_recoder_c_3) /* reinstated because of TALOS-2023-1805 */ { fprintf(stderr,"$VAR encountered after $ENDDEFINITIONS near byte %d. VCD is malformed, exiting.\n", (int)(GLOBALS->vcdbyteno_vcd_recoder_c_3+(GLOBALS->vst_vcd_recoder_c_3-GLOBALS->vcdbuf_vcd_recoder_c_3))); @@ -2816,7 +2825,7 @@ str=wave_alloca(strlen(fname)+dlen+1); strcpy(str,WAVE_DECOMPRESSOR); strcpy(str+dlen,fname); - GLOBALS->vcd_handle_vcd_recoder_c_2=popen(str,"r"); + GLOBALS->vcd_handle_vcd_recoder_c_2=popen_san(str,"r"); GLOBALS->vcd_is_compressed_vcd_recoder_c_2=~0; } else