GithubHelp home page GithubHelp logo

tksvg's People

Contributors

apnadkarni avatar auriocus avatar oehhar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tksvg's Issues

windows: msys2: 32-bit gcc 10.1.0

This new compiler version is causing me issues.
It appears that images created with tksvg using gcc 10.1.0 are not working right.
It crashes when the image is put to use.
64-bit, same version of the compiler works fine.

missing INSTALL_FLAGS

For some reason, the configure script is missing INSTALL_FLAGS.
I don't know why autoconf would miss that.

Is tksvg 0.9 still claiming to be 0.8?

In configure:

Identity of this package.

PACKAGE_NAME='tksvg'
PACKAGE_TARNAME='tksvg'
PACKAGE_VERSION='0.8'
PACKAGE_STRING='tksvg 0.8'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Potential buffer overflow (integer overflow for insane image sizes)

Here, the size of the image buffer is computed by 32bit signed integer math, which may lead to overflow for insane settings of width and height, or e.g. -scale:

imgData = (unsigned char *)attemptckalloc(w * h *4);

Due to the integer wrap-around, it may result in the successful allocation of a small buffer. Suggested fix: Use 64bit math, e.g.

(size_t)w * (size_t) h
and check for overflow (painful). Or don't use ckalloc, but malloc.

Protect against version 8.7

I recommend that the pkgIndex.tcl file be changed to have:

if { [package vcompare 8.7 [info tclversion]] > 0 } {
...
}

to protect against inclusion in Tk 8.7 and later.
There is a possibility that the multiple inclusion can cause corruption in 8.7.

compilation warnings

Linux: ubuntu 16.04 64-bit, gcc 5.4.0

./generic/tkImgSVG.c: In function ‘ParseSVGWithOptions’:
./generic/tkImgSVG.c:426:2: warning: enumeration value ‘OPT_DPI’ not handled in switch [-Wswitch]
switch ((enum fmtOptions) optIndex) {
^

Extended check for correct parsing.

When loading tksvg package, "image put" statements do not work correctly anymore.
That's because the parser does not check, if the SVG image could be read correctly.
See following test script (disable package require tksvg to see how it should look):

package require Tk
package require tksvg

proc CreateCellImg { color } {
set img [image create photo -height 13 -width 13]
$img put $color -to 0 0 13 13
return $img
}

for { set i 1 } { $i < 10 } { incr i } {
set colorHex [format "#%02X%02X%02X" [expr $i20] [expr $i10] [expr $i*10]]
label .l_$i -image [CreateCellImg $colorHex]
pack .l_$i
}

Possible solution:
Add following code at the end of function ParseSVGWithOptions:

if (nsvgImage == NULL) {
    Tcl_SetResult(interp, "cannot parse SVG image", TCL_STATIC);
    Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL);
    goto error;
}
if (nsvgImage->width == 0.0 && nsvgImage->height == 0.0) {
    Tcl_SetResult(interp, "cannot parse SVG image", TCL_STATIC);
   Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL);
   goto error;
}

Another tksvg repository

Hi,

I maintain some Tcl/Tk packages for Debian; mainly as dependencies of the SAOImageDS9 package; however they are meant for general use as well. In future, SAOImageDS9 will pobably get tksvg as a new dependency. From the author of DS9, @wjoye, I now found another tksvg repository -- https://github.com/wjoye/tksvg which seems to focus on TEA compatibility. Would it be possible to cooperate?

I am asking since I would volunteer to maintain tksvg until Tcl/Tk 8.7 hits Debian mainline; however since I will need it for future DS9 releases, it is required to keep in sync with @wjoye's source.

Thanks for consideration!

Ole

tcl.m4 is very old

I've built tksvg on Win7x64 using Msys2 64-bit. It is working fine -- thank you!

I had to use a much more recent version of tcl.m4 and re-run autoconf

I used this one: tcl8.6.6/pkgs/thread2.8.0/tclconfig/tcl.m4

I copied the replacement tcl.m4 to tclconfig/ and reran 'autoconf'

Running this configure now works fine:

$ PATH="/C/progra1/tcl/bin:$PATH" ./configure
--with-tcl=/c/progra
1/tcl/lib
--with-tk=/c/progra~1/tcl/lib
--enable-64bit
--exec-prefix=pwd/PREFIX

A "make" builds the library correctly for windows 64-bit

The only problem is the "make install" which results in:

$ make install
/bin/sh ./tclconfig/install-sh -c @INSTALL_FLAGS@ tksvg01.dll /C/Users/me/Downloads/tcl/TkSvg/tksvg-master/PREFIX/lib/tksvg0.1/tksvg01.dll
cp: cannot stat '@INSTALL_FLAGS@': No such file or directory
mv: cannot stat '/C/Users/me/Downloads/tcl/TkSvg/tksvg-master/PREFIX/lib/tksvg0.1/#inst.5552#': No such file or directory
: /C/Users/me/Downloads/tcl/TkSvg/tksvg-master/PREFIX/lib/tksvg0.1/tksvg01.dll
Install pkgIndex.tcl /C/Users/me/Downloads/tcl/TkSvg/tksvg-master/PREFIX/lib/tksvg0.1
Installing header files in /mingw64/include

I don't know enough about autoconf etc. to remove the reference to @INSTALL_FLAGS@. I can easily work around it by either editing the Makefile or copying the DLL manually.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.