diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp
index 6dd75be50f872b870f54205c69f0f5a378a957f4..1d5899070332b22b1987aa1b4e4d0335c9569b9f 100644
--- a/indra/llmessage/patch_code.cpp
+++ b/indra/llmessage/patch_code.cpp
@@ -229,7 +229,7 @@ void	decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp)
 	gPatchSize = gopp->patch_size; 
 }
 
-void	decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph)
+void	decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, bool b_large_patch)
 {
 	U8 retvalu8;
 
@@ -268,15 +268,25 @@ void	decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph)
 #endif
 	ph->range = retvalu16;
 
-	retvalu16 = 0;
+	retvalu32 = 0;
 #ifdef LL_BIG_ENDIAN
-	ret = (U8 *)&retvalu16;
-	bitpack.bitUnpack(&(ret[1]), 8);
-	bitpack.bitUnpack(&(ret[0]), 2);
+	ret = (U8*)&retvalu32;
+	if (b_large_patch)
+	{
+		bitpack.bitUnpack(&(ret[3]), 8);
+		bitpack.bitUnpack(&(ret[2]), 8);
+		bitpack.bitUnpack(&(ret[1]), 8);
+		bitpack.bitUnpack(&(ret[0]), 8);
+	}
+	else
+	{
+		bitpack.bitUnpack(&(ret[1]), 8);
+		bitpack.bitUnpack(&(ret[0]), 2);
+	}
 #else
-	bitpack.bitUnpack((U8 *)&retvalu16, 10);
+	bitpack.bitUnpack((U8*)&retvalu32, b_large_patch ? 32 : 10);
 #endif
-	ph->patchids = retvalu16;
+	ph->patchids = retvalu32;
 
 	gWordBits = (ph->quant_wbits & 0xf) + 2;
 }
diff --git a/indra/llmessage/patch_code.h b/indra/llmessage/patch_code.h
index 4c87c9808a4bf883c1546474866417f4af02aaa0..bdaabe70bdcac1dc9a08dab661badc4e807297b2 100644
--- a/indra/llmessage/patch_code.h
+++ b/indra/llmessage/patch_code.h
@@ -40,7 +40,7 @@ void	end_patch_coding(LLBitPack &bitpack);
 
 void	init_patch_decoding(LLBitPack &bitpack);
 void	decode_patch_group_header(LLBitPack &bitpack, LLGroupHeader *gopp);
-void	decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph);
+void	decode_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, bool b_large_patch = false);
 void	decode_patch(LLBitPack &bitpack, S32 *patches);
 
 #endif
diff --git a/indra/llmessage/patch_dct.h b/indra/llmessage/patch_dct.h
index 101231ec842ed0eee43d07c9ac2a799ab93247f0..e1d219d9c9eb8d61e09d305d08112be049871942 100644
--- a/indra/llmessage/patch_dct.h
+++ b/indra/llmessage/patch_dct.h
@@ -73,7 +73,7 @@ class LLPatchHeader
 	F32	dc_offset;		// 4 bytes
 	U16	range;			// 2 = 7 ((S16) FP range (breaks if we need > 32K meters in 1 patch)
 	U8	quant_wbits;	// 1 = 8 (upper 4 bits is quant - 2, lower 4 bits is word bits - 2)
-	U16	patchids;		// 2 = 10 (actually only uses 10 bits, 5 for each)
+	U32	patchids;
 };
 
 // Compression routines