PERFORCE change 219903 for review

Brooks Davis brooks at FreeBSD.org
Thu Dec 13 21:26:08 UTC 2012


http://p4web.freebsd.org/@@219903?ac=10

Change 219903 by brooks at brooks_zenith on 2012/12/13 21:25:16

	Use a per-instance offset rather than a bogus global one.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng-cheri/readpng-cheri.c#6 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng-cheri/readpng-cheri.c#6 (text+ko) ====

@@ -46,13 +46,14 @@
 
 int pngwidth;
 
-int offset = 0;
 static void
 cheri_read_data(png_structp png_ptr __unused, png_bytep data, png_size_t length)
 {
-      
-	memcpy_fromcap(data, 2, offset, length);
-	offset += length;
+	struct ibox_decode_state *ids;
+
+	ids = png_get_io_ptr(png_ptr);
+	memcpy_fromcap(data, 2, ids->offset, length);
+	ids->offset += length;
 }
 
 static void
@@ -92,6 +93,7 @@
 	is.sb = SB_CHERI;
 
 	ids.fd = -1;
+	ids.offset = 0;
 	/*
 	 * in principle we could update this via a capabilty,
 	 * but in practice we can reconstruct it on exit


More information about the p4-projects mailing list