Jan Breuer
2015-10-13 1cf2c568c9a8d3a515254036916219d1b12de4d0
Resolve #57: SCPI_ExprChannelListEntry() crashes with whitespaces
2个文件已修改
9 ■■■■■ 已修改文件
libscpi/src/expression.c 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/test/test_parser.c 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/expression.c
@@ -303,5 +303,11 @@
    if (res == SCPI_EXPR_ERROR) {
        SCPI_ErrorPush(context, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
    }
    if (res == SCPI_EXPR_NO_MORE) {
        if (!scpiLex_IsEos(&lex)) {
            res = SCPI_EXPR_ERROR;
            SCPI_ErrorPush(context, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
        }
    }
    return res;
}
libscpi/test/test_parser.c
@@ -760,6 +760,9 @@
    TEST_ChannelList("(@1,2!5:3!6!7)", 0, 2, FALSE, 1, (1), (0), SCPI_EXPR_OK, 0);
    TEST_ChannelList("(@1,2!5:3!6!7)", 1, 2, FALSE, 0, (0), (0), SCPI_EXPR_ERROR, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
    TEST_ChannelList("(@1,2!5:3!6!7)", 2, 2, FALSE, 0, (0), (0), SCPI_EXPR_ERROR, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
    TEST_ChannelList("(@1, 2)", 0, 1, FALSE, 1, (1), (0), SCPI_EXPR_OK, 0);
    TEST_ChannelList("(@1, 2)", 1, 1, FALSE, 0, (0), (0), SCPI_EXPR_ERROR, SCPI_ERROR_EXPRESSION_PARSING_ERROR);
}
int main() {