brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
690 stars 529 forks source link

Finding corrupted signatures #164

Open atkulp opened 5 years ago

atkulp commented 5 years ago

We are getting signatures sometimes that are clearly not invalid. The vast majority of captured signatures come through fine, but a small percentage are just a 45° diagonal line from the upper-left:

image

The raw data is:

NaN_NaN_NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN_NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN_000000000000000000000000000_000000000000000000000000000_0_0_000000000000000000000000000_000000000000000000000000000_0_0_0_0

Decoded from base30 looks like:

int[7][][] { int[2][] { int[2] { 19, 19 }, int[2] { 319, 319 } }, int[32][] { int[2] { 19, 19 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 9589, 9589 }, int[2] { 319, 319 } }, int[27][] { int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }, int[2] { 0, 0 }...

We call getData/base30 on every change event and save it raw to the database when the user clicks the Submit button. We haven't even been able to reproduce it since it's so rare, but some sequence of events is causing it. Any ideas for what could cause this?

atkulp commented 5 years ago

I've also found { -2147483648, -2147483648 } in invalid entries which is completely off-canvas. Any help would be appreciated!

brinley commented 5 years ago

I've never see this error. Have you tried calling getData on submit as oppose to on change? Also have you been able to correlate the corrupted signatures with certain browsers/devices?

atkulp commented 5 years ago

Our logs don't provide enough details to segment by browser/device. I'm sure that would be helpful! Possibly a touch vs mouse issue or something. Responding to the event is easier than explicitly referencing it on submit but we might need to try that. Are the x,y values relative to the canvas or some other reference? If I can simply filter out stroke coordinates that are outside of the canvas dimensions then it would be relatively easy to keep it valid.