google-code-export / bwip-js

Automatically exported from code.google.com/p/bwip-js
0 stars 0 forks source link

bwip-js crashes #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. starting the node demo via $ node node-demo

What is the expected output? What do you see instead?

loading: bwip.js
loading: bwipp/code128.js
loading: bwipp/renlinear.js
loading: fonts/ocrb10-04.js

bwipp/code128.js:2488
    if (t===undefined) throw new Error("dict: barcode: undefined");
                          ^
Error: dict: barcode: undefined
    at BWIPJS.<anonymous> (bwipp/code128.js:2488:27)
    at BWIPJS.call (bwip.js:302:21)
    at /root/bwip-js/node-bwipjs:124:5
    at Server.<anonymous> (/root/bwip-js/node-demo:17:2)
    at Server.emit (events.js:70:17)
    at HTTPParser.onIncoming (http.js:1610:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
    at Socket.ondata (http.js:1506:22)
    at TCP.onread (net.js:374:27)

What version of the product are you using? On what operating system?

bwip-js v0.2 with node.js v0.6.18 on Debian Squeeze 6.0.5

Original issue reported on code.google.com by pdgw...@gmail.com on 18 May 2012 at 8:12

GoogleCodeExporter commented 9 years ago
When I load 
http://localhost:3030/?bcid=qrcode&text=test&scale=3&rotate=C&parsefnc&alttext=a
lt_text I get an error. I'm not exactly sure but I think the strict equality 
operator is what's causing the problem.

Original comment by m...@chrisaiv.com on 16 Jul 2012 at 7:34

GoogleCodeExporter commented 9 years ago
In order to get things to work, I need to typecast certain objects. 
Specifically the arrays.

if( typeof( this.stk[this.ptr-1] == Array ) ){
    if ( Array(this.stk[this.ptr-1]).length != Number) console.log("length: invalid: " + 
    String(BWIPJS.pstype(Array(this.stk[this.ptr-1]))) );  
}
this.stk[this.ptr-1]=Array(this.stk[this.ptr-1]).length;

Original comment by m...@chrisaiv.com on 16 Jul 2012 at 7:45

GoogleCodeExporter commented 9 years ago
This issue has been resolved with the 0.4 release.  The problem was actually in 
the node-bwipjs module, which allowed nonsense URLs such as /favicon.ico to be 
passed to the encoders.  The new node-bwipjs fixes this issue by performing a 
series of sanity checks on the URL before proceeding.

Original comment by mwar...@metafloor.com on 26 Feb 2013 at 9:14