Commit 35764ba0 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Fixed subtype check of ISO2022 ASN.1 string types (bug 526554)



Change-Id: I145f6ba55ea4f2365938c14c74158846abf160f1
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 5495dce1
...@@ -1825,7 +1825,9 @@ void SubType::chk_this_value(Value *value) ...@@ -1825,7 +1825,9 @@ void SubType::chk_this_value(Value *value)
case Value::V_CSTR: case Value::V_CSTR:
case Value::V_ISO2022STR: case Value::V_ISO2022STR:
if (subtype!=ST_CHARSTRING) FATAL_ERROR("SubType::chk_this_value()"); if (subtype!=ST_CHARSTRING) FATAL_ERROR("SubType::chk_this_value()");
is_invalid = (charstring_st!=NULL) && !charstring_st->is_element(val->get_val_str()); is_invalid = (charstring_st!=NULL) && (val->get_valuetype() == Value::V_CSTR ?
!charstring_st->is_element(val->get_val_str()) :
!charstring_st->is_element(val->get_val_iso2022str()));
break; break;
case Value::V_USTR: case Value::V_USTR:
case Value::V_CHARSYMS: case Value::V_CHARSYMS:
......
...@@ -29,7 +29,8 @@ CODIRS := dynamicTemplate styleGuide topLevelPdu \ ...@@ -29,7 +29,8 @@ CODIRS := dynamicTemplate styleGuide topLevelPdu \
attribQualif HT48786 selectCase openTypeNames \ attribQualif HT48786 selectCase openTypeNames \
defaultParamUsageBeforeDecl deterministic readFromFile \ defaultParamUsageBeforeDecl deterministic readFromFile \
asn1_hyphen nameClash portTranslation UntaggedOnTopLevelUnionSwitch \ asn1_hyphen nameClash portTranslation UntaggedOnTopLevelUnionSwitch \
typeDescrGenWIthNoXER languageSpec asn1_opentype openTypeXER typeDescrGenWIthNoXER languageSpec asn1_opentype openTypeXER \
asnStringSubtypes
ifdef DYN ifdef DYN
CODIRS += mfgen-xsd CODIRS += mfgen-xsd
......
stringSubtypes
stringSubtypes.exe
StringSubtypes*.cc
StringSubtypes*.hh
Values*.cc
Values*.hh
stringSubtypes*.log
##############################################################################
# Copyright (c) 2000-2017 Ericsson Telecom AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Baranyi, Botond – initial implementation
#
##############################################################################
TOPDIR := ../..
include $(TOPDIR)/Makefile.regression
.SUFFIXES: .ttcn .asn .hh
.PHONY: all clean dep run
TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
TTCN3_MODULES = Values.ttcn
ASN1_MODULES = StringSubtypes.asn
GENERATED_SOURCES = $(ASN1_MODULES:.asn=.cc) $(TTCN3_MODULES:.ttcn=.cc)
GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
ifdef CODE_SPLIT
GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc))
else ifdef SPLIT_TO_SLICES
POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_))
POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc))
GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES)))
GENERATED_SOURCES += $(GENERATED_SOURCES2)
endif
OBJECTS = $(GENERATED_SOURCES:.cc=.o)
TARGET = stringSubtypes$(EXESUFFIX)
all: $(TARGET)
$(TARGET): $(GENERATED_SOURCES) $(USER_SOURCES)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS)
$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
compile: $(TTCN3_MODULES) $(ASN1_MODULES)
$(TTCN3_COMPILER) $(COMPILER_FLAGS) $^
clean distclean:
$(RM) $(TARGET) $(GENERATED_HEADERS) $(GENERATED_SOURCES) $(OBJECTS) *.log Makefile.bak
dep: $(GENERATED_SOURCES)
makedepend $(CPPFLAGS) $(GENERATED_SOURCES)
--/////////////////////////////////////////////////////////////////////////////
-- Copyright (c) 2000-2017 Ericsson Telecom AB
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the Eclipse Public License v1.0
-- which accompanies this distribution, and is available at
-- http://www.eclipse.org/legal/epl-v10.html
--
-- Contributors:
-- Baranyi, Botond
--
--/////////////////////////////////////////////////////////////////////////////
StringSubtypes
DEFINITIONS
AUTOMATIC TAGS
::=
BEGIN
IMPORTS ; -- nothing
-- Types
TeletexStringRestricted ::= TeletexString (SIZE(4))
VideotexStringRestricted ::= VideotexString (SIZE(1..10))
GraphicStringRestricted ::= GraphicString (SIZE(0..3))
T61StringRestricted ::= T61String (SIZE(5))
GeneralStringRestricted ::= GeneralString (SIZE(1))
ObjectDescriptorRestricted ::= ObjectDescriptor (SIZE(2..4))
-- Values
val T61StringRestricted ::= "abcde"
END
/******************************************************************************
* Copyright (c) 2000-2017 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Baranyi, Botond
*
******************************************************************************/
module Values {
import from StringSubtypes all;
function f() {
var TeletexStringRestricted x;
x := "ttxx";
}
const VideotexStringRestricted c := "aaaaa";
template GraphicStringRestricted t := "gr";
modulepar ObjectDescriptorRestricted mp := "xyz";
control {
var template GeneralStringRestricted vt := "Q";
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment