Cody

Solution 1794686

Submitted on 21 Apr 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
% Clean workspace !/bin/cp get_me.m safe !/bin/rm *.* !/bin/mv safe get_me.m !/bin/rm @* % Clean user's function from some known jailbreaking mechanisms functions = {'!','feval','str2func','regex','system','dos','unix','perl','java','fopen','write','save','setenv','path'}; fid = fopen('get_me.m'); st = char(fread(fid)'); for n = 1:numel(functions) st = regexprep(st, functions{n}, 'error(''No fancy functions!''); %', 'ignorecase'); end fclose(fid) % Force a function header, and comment first code's line (the supposedly users' function header) st = sprintf('function y = get_me()\n%%%s', st); fid = fopen('get_me.m' , 'w'); fwrite(fid,st); fclose(fid) % Release the Kraken! get_me() % Try to cleanup the mess !/bin/cp get_me.m safe !/bin/rm *.* !/bin/mv safe get_me.m !/bin/rm @* path(pathdef) % undo any change on search path assert(isequal(ans,now))

/bin/rm: cannot remove '@*': No such file or directory ans = 0 ans = 0 ans = 42 /bin/rm: cannot remove '@*': No such file or directory

Assertion failed.

Suggested Problems

More from this Author6