Description: Avoid unaligned reads.
 Unaligned reads are especially harmful on sparc, where they lead to
 application crashes (with bus error).
Author: Nicolas Boullis <nboullis@debian.org>
Applied-Upstream: 0.82, http://git.savannah.gnu.org/cgit/libcdio.git/commit/?id=2522c26ec8082be46ee4012cfac76467bb0fb350
--- a/lib/driver/image/nrg.c
+++ b/lib/driver/image/nrg.c
@@ -715,23 +715,28 @@
 	
       case SINF_ID: { /* "SINF" */
 	
-	uint32_t *_sessions = (void *) chunk->data;
+	uint32_t _sessions;
 	
 	cdio_assert (UINT32_FROM_BE (chunk->len) == 4);
 	
+	memcpy(&_sessions, chunk->data, 4);
+
 	cdio_debug ("SINF: %lu sessions", 
-		    (long unsigned int) UINT32_FROM_BE (*_sessions));
+		    (long unsigned int) UINT32_FROM_BE (_sessions));
       }
 	break;
 	
       case MTYP_ID: { /* "MTYP" */
-	uint32_t *mtyp_p = (void *) chunk->data;
-	uint32_t mtyp  = UINT32_FROM_BE (*mtyp_p);
+	uint32_t mtyp_be;
+	uint32_t mtyp;
 	
 	cdio_assert (UINT32_FROM_BE (chunk->len) == 4);
 
+	memcpy(&mtyp_be, chunk->data, 4);
+	mtyp = UINT32_FROM_BE (mtyp_be);
+
 	cdio_debug ("MTYP: %lu", 
-		    (long unsigned int) UINT32_FROM_BE (*mtyp_p));
+		    (long unsigned int) mtyp);
 
 	if (mtyp != MTYP_AUDIO_CD) {
 	  cdio_log (log_level,
