Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encode string as octets before passing to md5_hex() #466

Merged
merged 4 commits into from
Apr 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/WeBWorK/EquationCache.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extending to the end of the line is also ignored.
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use Encode qw(encode_utf8 );
use Fcntl qw(:DEFAULT :flock);
BEGIN { my @_junk = (O_RDWR,O_CREAT,LOCK_EX) } # get rid of "subroutine redefined" warnings

Expand Down Expand Up @@ -86,7 +87,7 @@ sub lookup {
# Option 2 (the old default): remove all whitespace
# $tex =~ s/\s+//g;

my $md5 = md5_hex($tex);
my $md5 = md5_hex(encode_utf8($tex));

my $db = $self->{cacheDB};
unless($db) { return($md5 ."1"); }
Expand Down