Skip to content

Commit

Permalink
dev 1.3.1-rc.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dderjoel committed Aug 16, 2022
1 parent 4c2223f commit b36967a
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 11 deletions.
5 changes: 5 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
version 1.3.1-rc.3 (2022-08-17)

- fixed a bug which caused writing to a file via the -P switch to cause a
segmentation fault

version 1.3.1-rc.2 (2022-08-09)

- added four encodings for {vmovdqu, vmovupd} xmmN {xmmN,m/128}
Expand Down
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ TAP_LOG_COMPILER = ./test/tap/compiler.sh

# add TAP tests here
TEST_TAP = \
test/tap/call.tap \
test/tap/cmp.tap \
test/tap/imul.tap \
test/tap/lea.tap \
Expand Down Expand Up @@ -154,7 +155,8 @@ XFAIL_TESTS= $(TEST_EAF) \
test/tap/nasm_incompatible.tap

# add SH-tests here
TEST_SH = test/tools/asmline.sh
TEST_SH = test/tools/asmline.sh \
test/tools/asmlineP.sh


# add .c -tests here
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([assemblyline],[1.3.1-rc.2],[[email protected]])
AC_INIT([assemblyline],[1.3.1-rc.3],[[email protected]])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/assemblyline.c])
AC_CONFIG_AUX_DIR([build-aux])
Expand Down
23 changes: 23 additions & 0 deletions test/tap/call.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
push rax
push rcx
push rdx
push r8
push r9
push r10
mov rcx, 0x637ea511
mov rdx, 0x637ea4d1
mov r8, 0x637ea4f1
mov r9, 0x0
push 0x0
push 0x0
mov r10, 0x61813ff0
call r10
pop rcx
pop rcx
pop r10
pop r9
pop r8
pop rdx
pop rcx
pop rax
ret
16 changes: 16 additions & 0 deletions test/tools/asmlineP.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# error out on any error
set -e

tool=./tools/asmline
# should not error out without option to '-r'
${tool} -r <<EOF
ret
EOF

# should not error out without option to '-P /dev/stdout'

${tool} -P /dev/stdout <<EOF
ret
EOF
16 changes: 7 additions & 9 deletions tools/asmline.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,10 @@ static int create_binary_file(assemblyline_t al, enum OUTPUT create_bin,
switch (create_bin) {

case BIN_FILE: {
char bin_ext[] = ".bin";
size_t bin_file_len = strlen(param_file) + strlen(bin_ext) + 1;
char *bin_file = calloc(bin_file_len, sizeof(char));
sprintf(bin_file, "%s%s", param_file, bin_ext);
write_file = bin_file;
const size_t len_ext = 5; // 4chars for '.bin', 1 for \0
size_t bin_file_len = strlen(param_file) + len_ext;
write_file = calloc(bin_file_len, sizeof(char));
snprintf(write_file, bin_file_len, "%s.bin", param_file);
} break;

case GENERIC_FILE:
Expand All @@ -334,14 +333,12 @@ static int create_binary_file(assemblyline_t al, enum OUTPUT create_bin,
fprintf(stderr, "failed to create %s\n", param_file);
ret = EXIT_FAILURE;
}

if (write_file != NULL)
// free if we've allocated that filename
if (create_bin == BIN_FILE)
free(write_file);
return ret;
}

/** enum mode { M_STDIN, M_STDIN_COUNT, M_FILE, M_FILE_COUNT }; */

struct mode {
enum src { STD, FLE } src : 1;
bool count : 1;
Expand All @@ -364,6 +361,7 @@ struct mode findMode(struct parsed_ops *ops, int argc) {
}
return ret;
}

int main(int argc, char *argv[]) {

int total_chunk_brks = -1;
Expand Down

0 comments on commit b36967a

Please sign in to comment.