BMCLua: Verification of Lua Programs in Digital TV Interactive Applications Francisco A. P. Januario, Lucas C. Cordeiro, and Vicente F. de Lucena Jr.

Eddie B. de Lima Filho Science, Technology and Innovation Center for the Industrial Pole of Manaus − CT-PIM Email: [email protected]

Federal University of Amazonas − UFAM Email: {franciscojanuario,lucascordeiro,vicente}@ufam.edu.br Abstract—The present paper describes a novel scheme for checking for potential defects in Lua programs, by using Bounded Model Checking (BMC). Such an approach, called BMCLua, translates a Lua program into an ANSI-C one, which is then verified by the Efficient SMT-Based Bounded Model Checker (ESBMC). BMCLua is able to check for safety properties related to array bounds, division by zero, and user-specified assertions, in Lua programs. This paper marks the first application of BMC to Lua programs. The experimental results show that the performance of BMCLua is similar to that of ESBMC, in about 70% of the benchmarks used for evaluation. Keywords—Digital TV, Model Checking, Lua.

I.

I NTRODUCTION

The advent of digital TV allowed viewers to interact with television programming. The Brazilian Digital TV System (Sistema Brasileiro de Televis˜ao Digital - SBTVD), which is based on the Integrated Services Digital Broadcasting (ISDB), enabled the development of interactive applications, with the use of programming languages such as the Nested Context Language (NCL) [1], which is declarative, and the Lua script language [2], which is imperative. As other programming languages, errors that are not detected in Lua programs may cause problems, during application execution in digital TV receivers (e.g., the application may simply freeze). This paper describes a novel approach for checking possible violations of safety properties in Lua programs, which is based on the Efficient SMT-Based Bounded Model Checker (ESBMC) [3]. Such an approach is implemented in a tool called Bounded Model Checking of Lua programs, which is called BMCLua. Lua is a powerful and light script language, which was designed to extend applications written in other programming languages, mainly for interactive applications and games. In this work, the ANSI-C programming language is used as modelling language for the translator module of the BMCLua tool, since ESBMC supports C/C++ programs. To the best of our knowledge, this is the first work that applies BMC to the Lua programming language. II.

straightforward. Additionally, it extends features of digital TV applications via the use of the NCLua library (e.g., in order to respond to remote control keys). Some programming errors that are common in Lua programs include incorrect implicit conversion of variable types, returning null from functions with multiple values, and arithmetic overflow. In NCLua scripts, potential programming errors can occur during event handling or graphic-object drawing. The Lua programming language does not define the data type of a variable declaration, i.e., it is not a strongly-typed language. In Lua, a variable can accept values of different types, hindering the translation of assignment statements. The “table” data type incurs additional complexity in its translation, since it is used to create other structures (e.g., arrays and structs that are typically used in C). Moreover, functions are particularly difficult to translate, because they are considered value types and are used as objects or elements of a table. III.

ESBMC

ESBMC is a Context-Bounded Model Checker based on Satisfiability Modulo Theories (SMT), which is used for ANSI-C/C++ programs [3]. ESBMC verifies sequential and multi-threaded programs and checks for properties related to arithmetic overflow, division by zero, out-of-bounds index, pointer safety, deadlocks, and data races. In ESBMC, the verification process is completely automated and does not require the user to annotate programs with pre/post-conditions. control-flow graph

GOTO program

IRep trees

type check

Parse tree

scan

OK

symbolic execution Convert contraints

GOTO symex

SSA form

C/C++ source

Select SMT solver

Logical Context

Property holds up to bound k SMT solver Property violation

Convert properties

Interpret counter-example

T HE L UA P ROGRAMMING L ANGUAGE

Lua is a programming language that is typically used for developing games and digital TV applications [4]. In practice, however, it is an extension language that can be used together with other programming languages (e.g., NCL) [1]. It is worth noticing that Lua is quite fast and easy to code, which is very important for the development of digital TV interactive applications, in real-time. The Lua syntax is small, clean, and

Fig. 1.

Overview of the ESBMC architecture.

Fig. 1 shows the ESBMC architecture. As depicted, ESBMC converts an ANSI-C/C++ program into a GOTOprogram, which simplifies statement representations (e.g., replacement of while by if and goto statements). Then, the GOTO-program is executed symbolically by the GOTO-symex,

which generates a Single Static Assignment (SSA) form that is later converted into a first-order logic formula; the latter is finally checked by an SMT solver. If a property violation is found, then a counterexample is provided by ESBMC, which assigns values to the program variables to reproduce the error. IV.

properties, TL is the total verification time, which includes translation and verification, and TE is the total verification time used for checking the respective ANSI-C code, in the ESBMC tool, which is used for comparison purposes with TL. TABLE I.

Benchmark

ANTLR

Bellman-Ford

The ANother Tool for Language Recognition (ANTLR) [5] is a syntax and lexical analyzer generator for programming languages, which automates the development of languages recognizers (e.g., translators and interpreters). From a grammar that is built from the syntax of a given target language, ANTLR generates classes in Java programming language, which are the lexical analyzer (i.e., the lexer) and the syntax analyzer (i.e., the parser). For a translator built by ANTLR, the lexer generates a symbol stream (i.e., tokens) from a sequence of input characters. The parser, in turn, checks the syntax of the input characters, by analyzing an Abstract Symbol Tree (AST) structure, which is generated by ANTLR. Additionally, from the parser, the output can be easily converted to an ANSI-C program or to the syntax of a domain-specific language. V.

BMCL UA

The BMCLua is an efficient model checker for programs written in Lua, which was developed using the Java programming language. The basic functions of BMCLua are related to the translation of Lua into ANSI-C code and to the verification of the resulting ANSI-C code, using the ESBMC tool. Start

Lua code

Translator

ANSI-C code

NO Counterexample

Success ?

Result of the verification

Lua code OK

Overview of the BMCLua architecture.

As shown on the top of Figure 2, BMCLua translates Lua code into ANSI-C code, which is then verified by ESBMC. Here, the counterexample informs the code line where an error occurred, as well as the property violation that was detected. The BMCLua translator is built using the generated classes from the ANTLR tool (i.e., the “parser” and the “lexer”). VI.

Prim

BubbleSort

SelectionSort

Factorial

E 10 15 20 10 15 20 50 70 140 200 50 70 140 200 50 100 150 200 400

L 43 43 43 43 43 43 30 30 30 30 33 33 33 33 17 17 17 17 17

B 11 16 21 11 16 21 51 71 141 201 51 71 141 201 51 101 151 201 401

P 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

TL <1 <1 <1 <1 <1 <1 6 12 68 225 3 6 42 177 <1 <1 <1 <1 2

TE <1 <1 <1 <1 <1 <1 5 10 52 163 2 4 25 89 <1 <1 <1 <1 1

The experimental results show the notable performance of the BCMLua verification time. In particular, the verification time reported in the TL and TE columns are comparable to each other. Additionally, the verification time in the TL column, which is higher than the verification time in the TE one, occurs due to the increase of code lines when translating Lua into ANSI-C code. In most cases, however, the translation time is typically less than one second. In all experiments, BMCLua did not report any false-positive or false-negative result, proving its correctness to verify Lua programs. VII.

ESBMC

YES

Fig. 2.

E XPERIMENTAL RESULTS OF THE BMCL UA TOOL

C ONCLUSIONS

The experimental results show the efficiency and correctness of BMCLua to verify Lua programs. In particular, BMCLua is able to detect, in all benchmarks, properties related to division by zero and user-specified assertions without reporting any false-negative result. On average, the verification time of BMCLua is comparable to that of ESBMC; indeed, only 21% of the benchmarks present a verification time that is higher than the ESBMC verification time. Nevertheless, it is worth noticing that improvements in the BMCLua translator could further reduce such a difference. As a future work, BMCLua will be integrated into the Eclipse tool, which will then allow Lua program verification during development. BMCLua will also be integrated into the Ginga middleware, in order to check for Lua programs in interactive applications. Acknowledgements. This research was supported by Samsung, CNPq, and FAPEAM grants.

E XPERIMENTAL E VALUATION

R EFERENCES

The experiments performed with the BMCLua consist of using standard benchmarks from the related literature, in order to check its performance and correctness. The benchmarks include Bellman-Ford, Prim, BublleSort, SelectionSort, and Factorial. For each benchmark, loop and array limits are defined and verified via assertions.

[1]

Table I shows the experimental results, in seconds. The acronym E identifies the total number of elements of the array, L is the total number of lua code lines, B shows the limit of performed loop iterations, P means the total number of checked

[4]

[2] [3]

[5]

ABNT (Brazilian Association of Technical Standards), NBR 156062:2007: Digital terrestrial television − Data coding and transmission specification for digital broadcasting. Rio de Janeiro: ABNT, 2007. J. Kurt and B. Aaron, Beginning Lua Programming. Indianapolis: Wiley Publishing, 2007, p. 644. L. Cordeiro and et al., SMT-Based Bounded Model Checking for Embedded ANSI-C Software. In TSE, v. 38, n. 4, pp. 957–974, 2012. R. Brand˜ao and et al., Extended Features for the Ginga-NCL Environment: Introducing the LuaTV API, In ICCCN, pp. 1–6, 2010. T. Parr, The Definitive ANTLR Reference - Building Domain-Specific Languages. North Carolina: The Pragmatic Bookshelf, 2007.

BMCLua: Verification of Lua Programs in Digital TV ... - SSVLAB

enabled the development of interactive applications, with the ... developing games and digital TV applications [4]. ... Overview of the ESBMC architecture. Fig.

252KB Sizes 0 Downloads 112 Views

Recommend Documents

BMCLua: Verification of Lua Programs in Digital TV ... - SSVLAB
Email: 1franciscojanuario,lucascordeiro,[email protected]. Eddie B. de Lima ... verification process is completely automated and does not require the user to ...

Cheap Tv Stick Dvb-T2 Chromecast 1080P Digital Terrestrial Tv ...
Cheap Tv Stick Dvb-T2 Chromecast 1080P Digital Terr ... mi Usb Tv-Tuner Free Shipping & Wholesale Price.pdf. Cheap Tv Stick Dvb-T2 Chromecast 1080P ...

Cheap Hd Clear Vision Digital Tv Antenna Satellite Tv Receiver ...
Cheap Hd Clear Vision Digital Tv Antenna Satellite Tv ... x Vhf Uhf Receiver Free Shipping & Wholesale Price.pdf. Cheap Hd Clear Vision Digital Tv Antenna ...

Cheap Hd Clear Vision Digital Tv Antenna Satellite Tv Receiver ...
Cheap Hd Clear Vision Digital Tv Antenna Satellite Tv ... x Vhf Uhf Receiver Free Shipping & Wholesale Price.pdf. Cheap Hd Clear Vision Digital Tv Antenna ...

Design and verification for dual issue digital signal processor
Abstract-Digital Signal Processor (DSP) has been widely used in processing video and audio streaming data. Due to the huge amount of streaming data, ...

Digital Signature Verification on Mobile Devices
With the purpose of having a solution that can be used in any mobile device, the e-signature solution should be independent of the operating system. • A user can have more than one identity. Therefore, it should be interesting that the solution cou

Verification of Employment.pdf
TO WHOM IT MAY CONCERN: The applicant/participant is applying for housing assistance subsidized through the Department of. Housing and Urban Development. Federal regulations require that all income, expenses,. preferences and other information relate

Verification of Employment.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Verification of ...Missing:

Digital Signature Verification on Mobile Devices - International Journal ...
qualified signature, mobile signature, SIM card, Java ME, signature services, mobile devices, .... Microsoft's cryptographic system basically consists of several components; ... out the following functions: the generation and exchange keys, data ...

Verification of Residence.pdf
1940 Ralston Avenue (corner of Villa & Ralston). Direct (650) 590-4525 (650) 592-7111. San Mateo. Agency Insurance. 25 W. 25th Ave. Patio #8. 572-8944. Page 2 of 2. Verification of Residence.pdf. Verification of Residence.pdf. Open. Extract. Open wit

Cheap Mini Dvb-T Usb Tuner Tv Receiver Dvb T Hd Digital Tv ...
Cheap Mini Dvb-T Usb Tuner Tv Receiver Dvb T Hd Digi ... indows 7 ⁄ Vista Free Shipping & Wholesale Price.pdf. Cheap Mini Dvb-T Usb Tuner Tv Receiver Dvb ...

Cheap Digital Atsc Tv Receiver Watch Atsc Live Tv On Android ...
Cheap Digital Atsc Tv Receiver Watch Atsc Live Tv On ... a ⁄Mexico⁄Canada Free Shipping & Wholesale Price.pdf. Cheap Digital Atsc Tv Receiver Watch Atsc ...

VERIFICATION OF LANDSCAPE ARCHITECT LICENSURE.pdf ...
VERIFICATION OF LANDSCAPE ARCHITECT LICENSURE.pdf. VERIFICATION OF LANDSCAPE ARCHITECT LICENSURE.pdf. Open. Extract. Open with.

lua debugger.pdf
Sign in. Loading… Whoops! There was a problem loading more pages. Whoops! There was a problem previewing this document. Retrying... Download. Connect ...

Cheap Hd Digital Tv Receiver Usb Dvb-T2 Tv Stick For Android ...
Cheap Hd Digital Tv Receiver Usb Dvb-T2 Tv Stick For ... -T2 Signal Hd809 Free Shipping & Wholesale Price.pdf. Cheap Hd Digital Tv Receiver Usb Dvb-T2 Tv ...

Cheap Dvb-T2 Mini Size Hd Tv Digital Terrestrial Tv Tuner Fta ...
Cheap Dvb-T2 Mini Size Hd Tv Digital Terrestrial Tv ... ox Hdmi Playback Free Shipping & Wholesale Price.pdf. Cheap Dvb-T2 Mini Size Hd Tv Digital Terrestrial ...

Cheap Ces-Clear Tv Hd Digital Antenna - As Seen On Tv - No More ...
Cheap Ces-Clear Tv Hd Digital Antenna - As Seen On T ... Bills New Black Free Shipping & Wholesale Price.pdf. Cheap Ces-Clear Tv Hd Digital Antenna - As ...