changeset 26414:a7031923e4dc

demux_asf: Fix operator precedence in packet length check Change (len & 3-1) to correct ((len & 3) - 1) in packet length check. Also change "a - 1 < b" to simpler "a <= b".
author uau
date Sun, 13 Apr 2008 23:04:07 +0000
parents e988b302467e
children cc7c52fa5eb1
files libmpdemux/demux_asf.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_asf.c	Sun Apr 13 22:57:47 2008 +0000
+++ b/libmpdemux/demux_asf.c	Sun Apr 13 23:04:07 2008 +0000
@@ -46,7 +46,7 @@
  * \param len lowest 2 bits indicate number of bytes to read
  */
 static inline int check_varlen(uint8_t *ptr, uint8_t *endptr, int len) {
-    return len&3 ? ptr + (1<<(len&3 - 1)) - 1 < endptr : 1;
+    return len&3 ? ptr + (1<<((len&3) - 1)) <= endptr : 1;
 }
 
 static void asf_descrambling(unsigned char **src,unsigned len, struct asf_priv* asf){