Skip to content

Commit 101c5a2

Browse files
committed
Add x86 specs
1 parent ca7d6ec commit 101c5a2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

spec/lib/rex/arch/x86_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,38 @@
10041004
it "returns a register as third element" do
10051005
expect(subject[2]).to be_an Fixnum
10061006
end
1007+
1008+
context "when modified_registers passed" do
1009+
let(:modified_registers) { [] }
1010+
it "add modified registers" do
1011+
described_class.geteip_fpu(badchars, modified_registers)
1012+
expect(modified_registers).to_not be_empty
1013+
end
1014+
1015+
it "modifies 2 or 3 registers" do
1016+
described_class.geteip_fpu(badchars, modified_registers)
1017+
expect(modified_registers.length).to be_between(2, 3)
1018+
end
1019+
1020+
it "modifies ESP" do
1021+
described_class.geteip_fpu(badchars, modified_registers)
1022+
expect(modified_registers).to include(Rex::Arch::X86::ESP)
1023+
end
1024+
end
10071025
end
10081026

10091027
context "when too many badchars" do
10101028
let(:badchars) { (0x00..0xff).to_a.pack("C*") }
10111029

10121030
it { is_expected.to be_nil }
1031+
1032+
context "when modified_registers passed" do
1033+
let(:modified_registers) { [] }
1034+
it "doesn't add any register" do
1035+
described_class.geteip_fpu(badchars, modified_registers)
1036+
expect(modified_registers).to be_empty
1037+
end
1038+
end
10131039
end
10141040
end
10151041

0 commit comments

Comments
 (0)