summaryrefslogtreecommitdiffstats
path: root/demux/ebml.c
diff options
context:
space:
mode:
Diffstat (limited to 'demux/ebml.c')
-rw-r--r--demux/ebml.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/demux/ebml.c b/demux/ebml.c
index 44fa0c0793..7f62f1ff90 100644
--- a/demux/ebml.c
+++ b/demux/ebml.c
@@ -20,8 +20,6 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdbool.h>
#include <inttypes.h>
@@ -180,14 +178,14 @@ int ebml_read_skip(struct mp_log *log, int64_t end, stream_t *s)
if (len >= INT64_MAX - pos2 || (end > 0 && pos2 + len > end))
goto invalid;
- if (!stream_skip(s, len))
+ if (!stream_seek_skip(s, pos2 + len))
goto invalid;
return 0;
invalid:
mp_err(log, "Invalid EBML length at position %"PRId64"\n", pos);
- stream_seek(s, pos);
+ stream_seek_skip(s, pos);
return 1;
}
@@ -198,6 +196,7 @@ int ebml_resync_cluster(struct mp_log *log, stream_t *s)
{
int64_t pos = stream_tell(s);
uint32_t last_4_bytes = 0;
+ stream_read_peek(s, &(char){0}, 1);
if (!s->eof) {
mp_err(log, "Corrupt file detected. "
"Trying to resync starting from position %"PRId64"...\n", pos);
@@ -223,7 +222,7 @@ int ebml_resync_cluster(struct mp_log *log, stream_t *s)
#define E_S(str, count) EVALARGS(E_SN, str, count, N)
#define FN(id, name, multiple, N) { id, multiple, offsetof(struct ebml_ ## N, name), offsetof(struct ebml_ ## N, n_ ## name), &ebml_##name##_desc},
#define F(id, name, multiple) EVALARGS(FN, id, name, multiple, N)
-#include "ebml_defs.c"
+#include "ebml_defs.inc"
#undef EVALARGS
#undef SN
#undef S
@@ -428,7 +427,7 @@ static void ebml_parse_element(struct ebml_parse_ctx *ctx, void *target,
uint32_t, num_elems[i]);
break;
default:
- abort();
+ MP_ASSERT_UNREACHABLE();
}
}
}
@@ -581,7 +580,7 @@ static void ebml_parse_element(struct ebml_parse_ctx *ctx, void *target,
MP_TRACE(ctx, "ebml_id %x\n", (unsigned)*idptr);
break;
default:
- abort();
+ MP_ASSERT_UNREACHABLE();
}
*countptr += 1;
error: