racket / draw

Other
18 stars 23 forks source link

memcpy given #<eof> in read-png-bytes #41

Open ccshan opened 3 years ago

ccshan commented 3 years ago

Loading the attached file causes the following error in DrRacket v8.2 [cs]:

memcpy: contract violation
  expected: exact-nonnegative-integer?
  given: #<eof>

context:
  (read-png-bytes . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/draw-lib/racket/draw/unsafe/png.rkt> 228 0 9596 169))
  (read-png . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/draw-lib/racket/draw/unsafe/png.rkt> 328 0 14170 620))
  (|do-load-bitmap/dispatch/known method in bitmap%| . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/draw-lib/racket/draw/private/bitmap.rkt> 454 4 16403 648))
  (|do-load-bitmap/port method in bitmap%| . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/draw-lib/racket/draw/private/bitmap.rkt> 423 4 14973 1116))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/draw-lib/racket/draw/private/syntax.rkt> 234 25 9144 19))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/draw-lib/racket/draw/private/bitmap.rkt> 169 2 4792 42346))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (do-make-object/real-class . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3581 0 194297 1099))
  (|load-file method in image-snip%| . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/snip-lib/racket/snip/private/snip.rkt> 1099 2 39480 2600))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (do-make-object/real-class . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3581 0 194297 1099))
  (|read method in image-snip-class%| . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/snip-lib/racket/snip/private/snip.rkt> 820 2 29301 2758))
  (|read-snips-from-file method in editor%| . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/mred/private/wxme/editor.rkt> 606 2 20616 8597))
  (|do-read-from-file method in text%| . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/mred/private/wxme/text.rkt> 2821 2 132288 583))
  (|do-insert-file method in text%| . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/mred/private/wxme/text.rkt> 2736 2 128336 2697))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/mred/private/editor.rkt> 238 23 8905 1268))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/mred/private/editor.rkt> 225 19 8223 2280))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/framework/private/editor-misc.rkt> 127 10 5004 644))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/framework/private/frame.rkt> 1408 2 55910 9283))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/framework/private/frame.rkt> 762 2 30458 7931))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/framework/private/frame.rkt> 1058 2 42186 11053))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/framework/private/frame.rkt> 256 2 9082 7172))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/drracket/private/frame.rkt> 814 4 34087 1456))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/drracket/private/unit.rkt> 1411 4 64079 169500))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/drracket/private/module-language.rkt> 1620 4 74932 16237))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/drracket/private/debug.rkt> 1844 4 77409 7759))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/drracket/private/module-language-tools.rkt> 88 4 3392 5267))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/drracket/private/syncheck/gui.rkt> 2110 6 107995 25119))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/gui-debugger/debug-tool.rkt> 1169 6 56967 21765))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/macro-debugger/tool.rkt> 120 6 3595 11521))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/quickscript/tool.rkt> 94 6 2796 12976))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/deinprogramm-signature/deinprogramm/signature/tool.rkt> 18 6 412 2572))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/htdp-lib/stepper/xml-tool.rkt> 339 8 13619 3018))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/htdp-lib/stepper/stepper-tool.rkt> 173 2 5725 2601))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/htdp-lib/test-engine/test-tool.rkt> 68 6 2399 5471))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/htdp-lib/xml/text-box-tool.rkt> 21 5 397 646))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (continue-make-object . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3607 0 195511 2890))
  (do-make-object/real-class . #(struct:srcloc #<path:/usr/local/racket/collects/racket/private/class-internal.rkt> 3581 0 194297 1099))
  (create-new-drscheme-frame . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/drracket/private/unit.rkt> 5640 2 260334 393))
  (#f . #(struct:srcloc #<path:/usr/local/racket/collects/racket/contract/private/arrow-higher-order.rkt> 375 33 20717 125))
  (#f . #(struct:srcloc #<path:/usr/local/racket/collects/racket/contract/private/arrow-val-first.rkt> 489 18 20850 36))
  (#f . #(struct:srcloc #<path:/usr/local/racket/collects/racket/contract/private/arrow-val-first.rkt> 489 18 20850 36))
  (loop . #(struct:srcloc ".../private/map.rkt" 40 19 1374 258))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/drracket/drracket/private/main.rkt> 908 1 38354 1991))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt> 435 6 19067 1056))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt> 486 32 21054 120))
  (#f . #(struct:srcloc #<path:/usr/local/racket/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt> 634 3 26076 58))
mflatt commented 3 years ago

It looks like the file has been corrupted, since there are a bunch of zero bytes starting at file offset 29902. The right error message would be something about a corrupted file or malformed PNG stream, however, instead of a misuse of eof.

ccshan commented 3 years ago

Hello and thanks! Yeah I see, I managed to recover all the text from the file. Maybe saving a file from DrRacket on Windows to Google Drive was unreliable.

ccshan commented 3 years ago

(I would love for the file to be loadable with only the corrupt images missing.)