summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-03 01:24:48 +0200
committerwm4 <wm4@nowhere>2014-10-03 01:24:48 +0200
commit433210535244e94d20d92eb272d27097daea9a11 (patch)
treea7cc386bffae69a8a5d14c9f9ff280309377f8b9 /player/command.c
parent3e899b102e4644baf347520d98ff44fd8a842fec (diff)
downloadmpv-433210535244e94d20d92eb272d27097daea9a11.tar.bz2
mpv-433210535244e94d20d92eb272d27097daea9a11.tar.xz
command: allow passing memory addresses to overlay_add
For the sake of libmpv. Might make things much easier for the user, especially on Windows. On the other hand, it's a bit sketchy that a command exists that makes the player access arbitrary memory regions. (But do note that input commands are not meant to be "secure" and never were - for example, there's the "run" command, which obviously allows running random shell commands.)
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index ef75594f7b..1b0a7df0cb 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3326,6 +3326,12 @@ static int overlay_add(struct MPContext *mpctx, int id, int x, int y,
if (!file[1] || end[0])
fd = -1;
close_fd = false;
+ } else if (file[0] == '&') {
+ char *end;
+ unsigned long long addr = strtoull(&file[1], &end, 0);
+ if (!file[1] || end[0])
+ addr = 0;
+ p = (void *)(uintptr_t)addr;
} else {
fd = open(file, O_RDONLY | O_BINARY | O_CLOEXEC);
}