]> gitweb.factorcode.org Git - factor.git/commitdiff
limit the byte-reader streams when loading images
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 28 Sep 2009 21:29:56 +0000 (16:29 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 28 Sep 2009 21:29:56 +0000 (16:29 -0500)
basis/images/loader/loader.factor

index 8c458b0c9f6db10d4688f3f15451625cfead543a..acb0f2ca8668bf5625f9663bd327ecd3b0fd685a 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors assocs byte-arrays combinators images
 io.encodings.binary io.pathnames io.streams.byte-array
 io.streams.limited kernel namespaces splitting strings
-unicode.case ;
+unicode.case sequences ;
 IN: images.loader
 
 ERROR: unknown-image-extension extension ;
@@ -33,7 +33,10 @@ GENERIC: stream>image ( stream class -- image )
     [ open-image-file ] [ image-class ] bi load-image* ;
 
 M: byte-array load-image*
-    [ binary <byte-reader> ] dip stream>image ;
+    [
+        [ binary <byte-reader> ]
+        [ length stream-throws <limited-stream> ] bi
+    ] dip stream>image ;
 
 M: limited-stream load-image* stream>image ;