diff --git a/autobuild.xml b/autobuild.xml
index f836af8b23..c9123da5a2 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1956,9 +1956,9 @@
archive
name
windows
@@ -1968,9 +1968,9 @@
archive
name
windows64
diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp
index e1e7863cca..7ee9c4f777 100644
--- a/indra/llkdu/llimagej2ckdu.cpp
+++ b/indra/llkdu/llimagej2ckdu.cpp
@@ -321,7 +321,12 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECod
// *TODO: This seems to be wrong. The base class should have no idea of
// how j2c compression works so no good way of computing what's the byte
// range to be used.
+#if (KDU_MAJOR_VERSION*10000 + KDU_MINOR_VERSION*100 + KDU_PATCH_VERSION) >= 80200
+ mCodeStreamp->set_max_bytes(max_bytes, false);
+#else
mCodeStreamp->set_max_bytes(max_bytes,true);
+#endif
+
// If you want to flip or rotate the image for some reason, change
// the resolution, or identify a restricted region of interest, this is